LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 11-02-2010, 11:55 AM   #1
protolocke
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

Code:
#!/bin/tcsh
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
Code:
chmod +x
to make it executable. The script only works if I replace the top line with
Code:
#!/bin/bash
instead. Am I missing something?

Any help is appreciated
 
Old 11-02-2010, 12:05 PM   #2
udaman
Member
 
Registered: Oct 2010
Location: New England, USA
Distribution: OpenSUSE/Slackware64/RHEL/Mythbuntu
Posts: 189

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.

Code:
#tcsh
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
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
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
protolocke
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:
Code:
bash
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.
 
  


Reply

Tags
bash, csh, script, terminal



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

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

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