Page 1 of 1

Bash Script Outputting Null

Posted: Thu Jan 28, 2021 1:56 pm
by EnderXncdr
I am running a local script and it works just fine when running manually.

#!/bin/bash

printer=$1

#--------------------------------#
# Query UPH value for printer

get_uph=$(grep $1 MULTIS.csv)
full_uph=$(echo $get_uph | cut -d "," -f12)
uph=$(printf "%.0f\n" $full_uph)

#--------------------------------#
if [ "$uph" -eq "0" ]; then
echo "OK: $uph"
exit 0
fi
if (( $uph > 84 )); then
echo $uph
exit 0
fi
if [ "$uph" -eq "84" ]; then
echo $uph
exit 1
fi
if (( $uph < 84 )); then
echo $uph
exit 2
fi

What happens is the output variable equals 0,no matter what it actually is. Are there any characters in the script it doesn't like? Here is what the command looks like.

define command {
command_name multisuph
command_line $USER1$/multis_uph.sh $HOSTNAME$
}

Re: Bash Script Outputting Null

Posted: Thu Jan 28, 2021 2:17 pm
by EnderXncdr
This can be closed. I figured it out. You have to put the full path to the csv file for it to work. Bang my head against a wall for 24 hours and it is that simple.