Bash Script Outputting Null
Posted: Thu Jan 28, 2021 1:56 pm
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$
}
#!/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$
}