11

bash script error with binary operator expected.

view full story
linux-howto

http://www.unix.com – Hello, I am not sure, where I am missing in the scirpt, I am trying to grep few users from /etc/passwd file and if exists, I added line to echo as user exist, if not create it. Code: #!/bin/bash for vid in v707  z307 z496 z163 z292 ; do if [ grep "$vid" /etc/passwd ] then         echo " $vid User exists " else         /usr/sbin/useradd -g admin -G app $vid         echo changeme |passwd --stdin $vid fi done error message Code: # ./adduser.sh ./adduser.sh: line 3: [: v707: binary oper (HowTos)