I'm having problems when running a script from cron. First I found difficulties accessing to SQLite; now it's AWK commands that are running me crazy.
The problematic line is this:
sens=`awk -F, '{ if($2 == '${num}' && $4 == '$tipogalis' && $9 == "0")print $1 }' /usr/xbow/xserve/galtel/relasens`
Don't want to bother you with the details; it's the main line of a while loop that has to read the value of a column inside a file. It works perfectly from the command line, but running as a cron job gives no value to the variable "sens".
I already checked out that all the variables inside the line are read OK (num, tipogalis, etc.), so I'm pretty sure the problem is related with the amount of "&&" or with the "print" function.
Just in case someone wants to suggest something about the enviroment vars, I already added the following lines at the beggining of the script:
LANG=en_US.UTF-8
export LANG
But made no difference.
Any other suggestion, please? I know the problem must be really tiny. Devil is always in details...