In python 2.4, how can I execute external commands with csh instead of bash? In python 2.4, how can I execute external commands with csh instead of bash? shell shell

In python 2.4, how can I execute external commands with csh instead of bash?


Just prefix the shell as part of your command. I don't have tcsh installed but with zsh:

>>> os.system ("zsh -c 'echo $0'")zsh0


How about:

>>> os.system("tcsh your_own_script")

Or just write the script and add

#!/bin/tcsh

at the beginning of the file and let the OS take care of that.


Just set the shell to use to be tcsh:

>>> os.environ['SHELL'] = 'tcsh'>>> os.environ['SHELL']'tcsh'>>> os.system("echo $SHELL")tcsh