my script is:
#!/bin/sh
if [[ $# -ne 1 ]] ; then
echo 'Command line arguments are not equal to 1'
exit 1
else
NUMBER=$(grep -n "$1" /acct/common/filename | tr -dc '0-9')
sed -n "$NUMBER"p /acct/common/filename | sed 's/,/ /g | sed "s/$1/ /g"
fi
The command in the else statement works when ran on its own in the script, but whenever I try to run the script the shell outputs
./findName.sh 2: ./findName.sh: [[: not found
Whenever I pass no arguments and then
./findName.sh: 2: ./findName.sh: [[: not found
expected result
Whenever I pass in an argument that should work
I'm not sure what's wrong as I am fairly new to shell scripting, any help would be greatly appreciated, thanks.