|
|
|
| for uid in `$AWK -F":" '{print $3}' $PASSWD` ; do
user=`grep "${uid}" $PASSWD | $AWK -F ":" {'print $1'}`
password=`grep "${user}" $SHADOW | $AWK -F ":" {'print $2'}
# line 37
if [ $password = "!!" ] ; then
#code
#line 42
elif [ $password = "*" ] ; then
#code
and I get the following errors could someone tell me where I am going wrong.
../script: line 37: [: too many arguments
../script: line 42: [: too many arguments
| |
| Måns Rullgård 2005-08-26, 3:56 am |
| "James" <invaild> writes:
> for uid in `$AWK -F":" '{print $3}' $PASSWD` ; do
> user=`grep "${uid}" $PASSWD | $AWK -F ":" {'print $1'}`
> password=`grep "${user}" $SHADOW | $AWK -F ":" {'print $2'}
>
> # line 37
> if [ $password = "!!" ] ; then
> #code
>
> #line 42
> elif [ $password = "*" ] ; then
> #code
>
> and I get the following errors could someone tell me where I am going wrong.
>
> ./script: line 37: [: too many arguments
> ./script: line 42: [: too many arguments
$password probably contains spaces. Try putting quotes around it.
--
Måns Rullgård
mru@inprovide.com
| |
| Rainer Temme 2005-08-26, 3:56 am |
| James wrote:
....
> # line 37
> if [ $password = "!!" ] ; then
> #code
>
> #line 42
> elif [ $password = "*" ] ; then
> #code
>
> and I get the following errors could someone tell me where I am going wrong.
>
> ./script: line 37: [: too many arguments
> ./script: line 42: [: too many arguments
....
Hi James,
-> "set -x" is youtr friend when it comes to strange
things in shell-scripts.
Try
if [ "$password" = "!!" ] ; then
....
elif [ "$password" = "*" ] ; then
....
and remember that * as well as !! are "special characters" that
means they get interpreted (and replaced) by the shell.
Regards ... Rainer
|
|
|
|