# newbie shellscript tryout help.

**URL:** <https://community.unix.com/t/newbie-shellscript-tryout-help/193573>\
**Category:** Shell Programming and Scripting\
**Created:** [April 17, 2008, 8:58pm UTC](https://community.unix.com/t/newbie-shellscript-tryout-help/193573 "2008-04-17T20:58:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cstudent](https://community.unix.com/letter_avatar/cstudent/32/6_449c533f586939b6e5f246632a46421f.png) [@cstudent](https://community.unix.com/u/cstudent)\
**Post date:** [April 17, 2008, 8:58pm UTC](https://community.unix.com/t/newbie-shellscript-tryout-help/193573/1 "2008-04-17T20:58:37Z")

</div>

hi, i have the following shellscript and it keeps telling me that Add: command not found. Can anyone explain to me whats wrong?

```nohighlight
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

```

---

<div class="post-metadata">

**Author:** ![Perderabo](https://community.unix.com/user_avatar/community.unix.com/perderabo/32/27_2.png) [@Perderabo](https://community.unix.com/u/Perderabo)\
**Post date:** [April 17, 2008, 9:17pm UTC](https://community.unix.com/t/newbie-shellscript-tryout-help/193573/2 "2008-04-17T21:17:52Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![cstudent](https://community.unix.com/letter_avatar/cstudent/32/6_449c533f586939b6e5f246632a46421f.png) [@cstudent](https://community.unix.com/u/cstudent)\
**Post date:** [April 17, 2008, 9:23pm UTC](https://community.unix.com/t/newbie-shellscript-tryout-help/193573/3 "2008-04-17T21:23:51Z")

</div>

i did delete the spaces but it still says command Add is not found 😕

```nohighlight
#!/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

```

---

<div class="post-metadata">

**Author:** ![cstudent](https://community.unix.com/letter_avatar/cstudent/32/6_449c533f586939b6e5f246632a46421f.png) [@cstudent](https://community.unix.com/u/cstudent)\
**Post date:** [April 17, 2008, 9:33pm UTC](https://community.unix.com/t/newbie-shellscript-tryout-help/193573/4 "2008-04-17T21:33:22Z")

</div>

opps ok solved it. thanks for the help
