Im trying to write a bash script that has an if statment that when the user enters ONLY that exact argument, will echo what follows that conditon.
For example:
for file in $1
do
if [ $ == "$1" ]
then
Var1=$(cat hello | egrep "that pattern" | awk '{ print $NF }')
cat $Var1
fi
done
Basically, if i specify anything other then 1 as this cmd files argument, it wont output anything.
But if i do specify 1 it will output the value that Var1 is holding... Another problem tha t i was having is that it will output when any 1 argument is passed. For example if 2 arguments are passed it wont output anything. If no arguments are passed it wont output anything. But it really doesnt matter what 1 argument i specify, it will output as long as 1 argument is givin.
What im trying to figure out from that point is how to write an if statement that looks for an exact match of that 1 argument that the user would specify.