[10:43] <pixie79> hi, can i create an env variable inside a pre-script whose variable is set by the output of a program, i.e env DATE=`date`
[10:43] <pixie79> as I have been trying but seem to get left with an empty variable
[10:44] <ion> If you add “printf "%s\n" "$DATE" >/tmp/foo” after that, what will /tmp/foo contain?
[10:45] <pixie79> ion, i had been doing echo "TZ:$TZ" >> /tmp/tz which just gave me TZ:
[10:45] <ion> Oh, also: you might want just ‘DATE="$(date)"’ or ‘export DATE="$(date)"’ in an sh script.
[10:46] <ion> Certainly not “env” in front of it.
[10:49] <pixie79> ok thanks that is correct, do i not need the 'env' in order to make is an environment variable which i can set for the main exec, ( i need to set the Timezone) the exec runs under
[10:55] <pixie79> hm, is this correct to check if a file exists and if it does not then exit printing a warning to daemon log. At the moment it seems to be stopping me when the file exists and printing nothing  [ ! -e $COMPFI ] && { echo "please enter CUST and COMP correctly" | logger -t CASS -p daemon.info ; stop; exit 0; }
[10:59] <ion> Alas, you can’t teleport environment variables between scripts just by setting them. You’ll need to set them in the main script and exec the final program in the end.
[11:00] <pixie79> ion ok, in that case i will move the tz to a main script, 
[11:00] <ion> You might want to add something like this to the beginning of the script to debug it:
[11:00] <ion> exec >/tmp/jobname.out 2>&1
[11:00] <ion> set -x
[11:03] <pixie79> thanks - i had not seen the exec/set -x before, looks useful, 
[11:07] <pixie79> ion: are these expecting bash style tests or something else ? as I am trying '!-e' to stop if the file does not exist
[11:08] <ion> if ! [ -e "$file" ]; then stop; exit; fi or something.
[11:19] <pixie79> ok that seems to be working better, now i just need to work out how to set the environment variable TZ so that when i exec the correct timezone is set, I have the value $TZ in the main script now correctly
[11:21] <pixie79> if i do: 'exec TZ=$TZ date' then i get an error that is tries to exec /TZ=Europe/London
[11:23] <ion> export TZ
[11:23] <ion> exec date
[11:24] <pixie79> arh - thanks thought i had tried that one :)
[11:28] <pixie79> ion: thanks for your help - i now have a working script, 1 down 2 to fix :)