I have a shell script that is suppose to take the output of autorep
command and use that output in the IF statement
but its not working
#!/bin/bash
read -r i
output=$(autorep -j $i -q | awk '/^insert_job:/ {printf "%s\n", $4}')
if [ $output == "CMD" ] || [ $output == "BOX" ];
then
echo "its a command or box job"
else
echo "Not a command or box job"
fi
if i modify this script to echo the output of the command
#!/bin/bash
read -r i
output=$(autorep -j $i -q | awk '/^insert_job:/ {printf "%s\n", $4}')
echo $output
then I get the result as:
CMD CMD CMD BOX BOX BOX CMD BOX
but the output should come on each line
The $i
is suppose to be a Wildcard that resolves to a series of jobs. Is there anything I am doing wrong here?