I can run setenv command just fine in my tcsh shell like this:echo $0/usr/bin/tcshecho $SHELL/usr/bin/tcshsetenv START_TIME `date +%s`echo $START_TIME1499355967But, whenever I run it explicitly like shown below, it doesn't work. I need to do this because I have to specify shell when executing it via python subprocess call, otherwise it will call a sh shell as default./usr/bin/tcsh -i -f -c 'setenv START_TIME `date +%s`'echo $START_TIMESTART_TIME: Undefined variable.What's the problem here? I searched for this issue online, but couldn't find any issue similar to this. This is extremely frustrating.
'setenv' command not working on tcsh shell when called explicitly
linux;shell;python;tcsh
You're running a separate invocation of the shell when you use /usr/bin/tcsh on the first line of your script. The echo command runs in the 'enclosing' shell - the one that has the commands in it.  Why not run both commands on the first line, like this:  /usr/bin/tcsh -i -f -c 'setenv START_TIME `date +%s`; echo $START_TIME'  Then they are both running in the same invocation of the shell. Replace the echo command with a call to your python program if you wish.