I'am creating a shell script, where in I need to pass two parameters (like hash tags) in for loop. for ex. (key value) here I'm comparing "value" parameter with some value and on base of which need to perform some action on "key" parameter.
like:
for i in $(echo `awk '{print $0}' ab4`); or for i in $(cat ab4);
do if [ "`awk -F":" '{print $2}' $i`" = "`some value`" ];
then echo "go ahead and restart app service on `awk '{print $1}' $i`";
{here i'll use the command to restart the service, but for that i need this $1 which is a hostname}
else echo "2nd condition here";
fi;
done.
content of ab4 is like:
hostname app.rpmversion
When i run this, getting error: "key" "value" in ab4 parameters are not a command.
Please assist