hi, i have the following shellscript and it keeps telling me that Add: command not found. Can anyone explain to me whats wrong?
for userName in `awk -F":" '{print $3}' passwd`
do
while [ $userName -gt 500 ]
do
echo $userName
$count = `expr $count + 1`
echo -n "Add $count"
done
done
You need to use:
count=`expr $count + 1`
No spaces around the the equals sign. No dollar sign in front of count when you are assigning it a value. But this doesn't explain the error you mentioned. I suspect you posted different code than you are really running. Look carefully at the those double quotes in your real code. Are you missing one?
i did delete the spaces but it still says command Add is not found
#!/bin/bash
#-c
#count = 0
for userName in `awk -F":" '{print $3}' passwd`
do
while [ $userName -gt 500 ]
do
# echo $userName
$count=`expr $count + 1`
echo "Add $count"
done
done
opps ok solved it. thanks for the help