Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-16-2013, 12:41 PM   #1
LQ Newbie
Registered: Jan 2013
Posts: 7

Rep: Reputation: Disabled
multiple shell scripts in multiple environments - quick question

Hi All

We have to ssh as root into a remote host, which runs a csh environment.
We need to invoke, from local host using ssh, a Bourne shell script on the remote host to set our application environment.
This script then calls other Bourne shell script to actually execute our desired commands.

ssh --> (in csh environment) --> (in csh environment)

We are having getting to execute. ssh simply stops at end of

We tried chaining the commands like
su auser -c "./; ./" (still it won't work)

Would the experts share their workaround ?

Thank you very much
Old 01-16-2013, 01:20 PM   #2
Senior Member
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
In order to run a script that's written in bash (i.e. it's interpretter is #!/bin/bash), in any other shell, use either sh or bash before script name, as:-
~$ sh scriptname
~$ bash scriptname
In your case, try:-
~$ su auser -c "sh; sh"
~$ su auser -c "bash; bash"
Simple use of ./ will certainlly give your error.
Old 01-16-2013, 05:13 PM   #3
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,880

Rep: Reputation: 1489Reputation: 1489Reputation: 1489Reputation: 1489Reputation: 1489Reputation: 1489Reputation: 1489Reputation: 1489Reputation: 1489Reputation: 1489
Normally you would put "#!/bin/sh" at the beginning of the file and make it executable.

Then the file itself identifies the shell to be used for interpreting the file.


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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Multiple Desktop Environments Arch Linux jdh313 Linux - Newbie 5 08-11-2011 11:27 AM
SHELL SCRIPT for multiple SCRIPTS rahulruns Programming 5 11-25-2009 12:13 PM
handling multiple files in shell scripts. wilsonsamm Linux - General 7 07-05-2006 07:36 PM
Using multiple desktop environments under Slackware? Frank Slackware 6 08-06-2003 03:38 AM
Compiling KDE 3.0 w/ multiple architecture flags (quick and easy question)? MatMan5959 Linux - Software 4 05-31-2002 02:57 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:32 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
Open Source Consulting | Domain Registration