Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 11-02-2010, 11:55 AM   #1
LQ Newbie
Registered: Jun 2010
Posts: 12

Rep: Reputation: 0
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
Old 11-02-2010, 12:05 PM   #2
Registered: Oct 2010
Location: New England, USA
Distribution: OpenSUSE/Slackware64/RHEL/Mythbuntu
Posts: 187

Rep: Reputation: 39
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

Last edited by udaman; 11-02-2010 at 12:09 PM.
Old 11-02-2010, 12:17 PM   #3
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,986
Blog Entries: 14

Rep: Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187
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!'?
Old 11-02-2010, 12:22 PM   #4
LQ Newbie
Registered: Jun 2010
Posts: 12

Original Poster
Rep: Reputation: 0
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.


bash, csh, script, terminal

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to make a bash script keep running in same terminal after it calls second script? JohnRock Linux - Newbie 4 06-25-2010 09:16 AM
Running Bash script in PHP script SteveMack2015 Linux - Software 2 05-14-2010 03:34 PM
trouble with my first bash script rootoutcast Programming 4 11-17-2009 11:25 PM
[bash] having trouble debugging this bash script. jons Programming 4 02-08-2007 06:51 AM
Trouble with a basic bash script Tengil Linux - Newbie 5 03-04-2004 12:59 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:51 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration