I need to run csh scripts from a bash shell and therefore temporary change to tcsh via a command. It works perfect in interactive mode but i cant figure out in a one line command. So in interactive mode i do in the bash shell:
tcsh
source my.tcshr
useMyTcshCmd
etc.
How can i do all of this in 1 command? Sorry for the newbie question...
In the terminal, use the chsh command and use it to swap from Bash (or whatever Shell you are using) to Tcsh. What is this? Entering the chsh command in a terminal will print out “Enter the new value, or press ENTER for the default” on the screen.
You can change the BASH prompt temporarily by using the export command. This command changes the prompt until the user logs out. You can reset the prompt by logging out, then logging back in.
with the current version of bash, modifying a script on-disk while it is running will cause bash to "try" to load the changes into memory and take these on in the running script. if your changes come after the currently executing line, the new lines will be loaded and executed.
tcsh -c "echo foo; echo bar"
Result:
foo bar
So this should work:
tcsh -c "source my.tcshr; useMyTcshCmd"
You should specify the interpreter directly in the script:
#!/usr/bin/tcsh
echo "doing stuff"
And then simply run the script:
./script
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With