BASH - while loop
[ This is cross-posted to the newbies forum ]
Why doesn't this work? It's just a simple while loop
#!/bin/sh
src='/home/sites/$sitenum/web'
sitenum = 1
limit = 8
while [ $sitenum < $limit ];
do
echo 'The location is $src'
let $sitenum = $sitenum + 1
done
What I expect to see is
The location is /home/sites/1/web
The location is /home/sites/2/web
The location is /home/sites/3/web
The location is /home/sites/4/web
The location is /home/sites/5/web
The location is /home/sites/6/web
The location is /home/sites/7/web
The errors are
[sitenum: command not found
[sitenum: command not found
[sitenum: command not found
[sitenum: command not found
[sitenum: command not found
[sitenum: command not found
sitenum: command not found (Note: that line is different from the ones above it)
limit: command not found
$limit: ambiguous redirect
|