You are working too hard to do something easy. Use what's been there (forever).
Environment variables are a way of passing named parameters to commands. The shell allows specifying environment variables either before or after a command. For example:
preston@brutus:~$ XX1=1 env | grep XX
preston@brutus:~$ env XX2=2 | grep XX
Since environment variables are meant to be used as named parameters, naturally, the "at" command captures environment variables.
preston@brutus:~$ XX1=1 XX2=2 at now + 1 minute
warning: commands will be executed using /bin/sh
at> env > _env_
job 2 at Sat Aug 5 09:33:00 2006
preston@brutus:~$ grep XX _env_
Very cool, and very simple - and stuff that was in Unix V7 (1979).
Hi, is there a way to know whether a jython script has been started (in Unix envts) by cron or 'by hand', from the script itself?
I'd like to skip confirmations in my scripts if they are run by cron...
I've tried executing externally the tty command, but it returns always "not a tty", in interactive and in cron mode (which is
somehow a right behaviour...)