Yes, I know C-shell is bad. No, I did not choose C-shell. Yes, I would prefer to use a proper shell. No, I cannot switch to a better shell.
I have a very simplistic script:
/tmp/env_test.csh
#!/bin/csh -f
env
When I run this script from my user that is logged in with a tcsh shell, SHELL equals /bin/tcsh. When I run this script from cron, SHELL equals /bin/sh.
Why is the SHELL not being updated appropriately? What do I need to do to resolve this issue?
$SHELLis not set to the correct shell. When cron is running using/bin/sh,$SHELL=/bin/sh, even after launching a C-shell script (#!/bin/csh -f). Perlbrew then assumes it's a Bourne shell and uses Bourne shell commands to set up the environment. This happens despite runningsource <perlbrew path>/perlbrew/etc/cshrcprior to runningperlbrew use. I solved this by insertingsetenv SHELL /bin/cshto the perlbrew cshrc.