I'm trying to create a simple if statement that takes the first set of input as an argument, then the second input as a file name, then run them against an egrep statement. I keep getting the error:
if:Expression Syntax. then: Command not found.
here is what I have so far...
#!/bin/csh
if [ "$#" -ne 2 ]; then
echo "usage ./Reagan_lab3.sh (-e|-p) input file"
exit 1
fi
if [ $1 == "--e" ]; then
egrep -o "(([0-9]{3})|[0-9]{3})[ -][0-9]{3}[ -][0-9]{4}" $2
elif [ $1 == "--p" ]; then
egrep -o "\b[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+\b" $2
else;
echo "please make a selection, -e for email or -p for phone number."
exit 2
fi
I haven't been able to find what it's looking for. Any help would be great.
Aucun commentaire:
Enregistrer un commentaire