The autostatus will give a status of RUNNING or SUCCESS or FAIL to the jobstat variable. This hack script works fine. Until I wanted to add some pazazzz. If jobstat equals SUCCESS, It would be cool to print it out on to the terminal in green. Anything else, like RUNNING or FAIL print out red.
#!/bin/bash
jobname=$1
hostnam=$(hostname -f | cut -d"." -f2 )
red=$(tput setaf 1)
green=$(tput setaf 2)
reset=$(tput sgr0)
hemisphere="PADC"
while true
do
jobstat=$(autostatus -J $jobname)
choptim=$(date | awk '{print $4}')
if [[ "$jobstat" == "SUCCESS" ]]; then
echo "$hemisphere $choptim ${green} ${jobstat} ${reset} $jobname"
else
echo "$hemisphere $choptim ${red}${jobstat}${reset} $jobname"
fi
done
However when i run it i get this error
line 14: conditional binary operator expected
line 14: syntax error near `$choptim'
line 14: `echo "$hemisphere $choptim ${green} ${jobstat} ${reset} $jobname"'