-   Linux - General (
-   -   Having trouble running tsch script in bash (

protolocke 11-02-2010 12:55 PM

Having trouble running tsch script in bash
I've got this simple script called test1, which I'm trying to execute in a bash shell using ./test1


echo 'Hello world!'

But I can't get it to work. When I run it, nothing happens. I've checked and I definitely have tcsh in /bin. I also used

chmod +x
to make it executable. The script only works if I replace the top line with

instead. Am I missing something?

Any help is appreciated

udaman 11-02-2010 01:05 PM

Do you think that might be because you're running the bash shell at login, and not the tcsh? Start tcsh, at the bash prompt, then run the script.


Edit: it works fine on my system, even if I'm running bash, and using #!/bin/tcsh

MensaWater 11-02-2010 01:17 PM

Works fine for me on CentOS5. Running the script from command line (bash) worked fine. Creating a script with a #!/bin/bash interpreter that in turn called the above script also worked fine.

This suggests the issue may be with your system. What does "file /bin/tcsh" show? Have you verified /bin/tcsh isn't a symbolic link to something else?

What happens if you simply switch shells by typing "tcsh" at command prompt then type in "echo 'Hello world!'?

protolocke 11-02-2010 01:22 PM

I figured out what the problem was, my ~/.tcshrc file had this in it:

Woops, sorry guys I forgot about this! I'm using linux on a university computer and set up a workaround back in September to start bash, as tcsh was the default shell.

All times are GMT -5. The time now is 01:15 PM.