arildjensen / cis-puppet

Center for Internet Security Linux Benchmark implementation for PuppetLabs
Other
117 stars 62 forks source link

/usr/local/sbin/f000.sh line 10 too many arguments #11

Closed supriyawishesu closed 10 years ago

supriyawishesu commented 10 years ago

Hi,

I am using c0010.pp for f0000.sh According to my understanding f0000.sh which is under scripts will be executed and provided the output(pass or fail) under /usr/local/sbin/ as f000.sh. But for me the f000.sh under scripts is just copiying the file and placing it under /usr/local/sbin. And when I execute just f0000.sh it is throwing me error.

!/bin/sh

  2
  3
  4 # This script is used by the cis Puppet module.
  5 # For the latest version see https://github.com/arildjensen/cis-puppet/
  6
  7
  8 COMMAND=`grep ^password /boot/grub/grub.conf 2>/dev/null`
  9
 10 if [ $COMMAND = x ];
 11   then
 12     echo fail;
 13   else
 14     echo pass;
 15 fi
 16

/usr/local/sbin/f000.sh: line 10: [: too many arguments

Please help me

arildjensen commented 10 years ago

If you change line 10 to

if [ "x$COMMAND" = "x" ];

does it work?

supriyawishesu commented 10 years ago

Hi,

!/bin/sh

  2
  3
  4 # This script is used by the cis Puppet module.
  5 # For the latest version see https://github.com/arildjensen/cis-puppet/
  6
  7
  8 COMMAND=`grep ^password /boot/grub/grub.conf 2>/dev/null`
  9
 10 if ["x$COMMAND" = "x"];
 11   then
 12     echo fail;
 13   else
 14     echo pass;
 15 fi

f000.sh: line 10: [xpassword --md5 $1$g2RyY1$Ar0Ql.fHg3/XP2BAfgAx//: No such file or directory pass

still I am getting the error

Let me know

arildjensen commented 10 years ago

It doesn't look like you're copying and pasting the code. For instance there is no space between [ and "

Can you please copy and paste the code below and run that?

#!/bin/sh

# This script is used by the cis Puppet module.
# For the latest version see https://github.com/arildjensen/cis-puppet/

COMMAND=`grep ^password /boot/grub/grub.conf 2>/dev/null`

if [ "x$COMMAND" = "x" ]; 
  then 
    echo fail; 
  else 
    echo pass;
fi
nibalizer commented 10 years ago

I think this is working now. Please re-open if you can reproduce.