scsh-users
[Top] [All Lists]

Using a bash script as command interpreter?

To: scsh-news@zurich.ai.mit.edu
Subject: Using a bash script as command interpreter?
From: Robert Morelli <morelli@math.utah.edu>
Date: Sun, 28 Apr 2002 17:15:15 -0600
Organization: Global Network Services - Remote Access Mail & News Services
I'm using scsh for some of my scripts but since it's not installed on 
my facility,  I have it in my home directory.  However,  I need binaries 
for several architectures,  so I tried using a script "scshswitch" as 
follows as the command interpreter:

--------------------------------------------------
#!/usr/local/bin/bash
echo "arg is" $1
if [ `uname` = "FreeBSD" ]; then
    /home/morelli/bin/freebsd_x86/bin/scsh -s $1
elif [ `uname` = "SunOS" ]; then
    /home/morelli/bin/SunOS/bin/scsh -s $1
elif [ `uname` = "Linux" ]; then
    /home/morelli/bin/Linux/bin/scsh -s $1
fi
--------------------------------------------------

This script is supposed to check what operating system is running and
hand a scsh script to the appropriate binary.  

However,  this doesn't work.  For instance,  I have a
script "hello" as follows
--------------------------------------------------
#!/home/morelli/bin/scshswitch
!#

(display "Hello World\n")
--------------------------------------------------

Note that this file lists scshswitch as its command interpreter rather 
than scsh.

If I enter
schswitch hello
then the script hello executes properly,  outputting "Hello World."
However,  when I try to run the script directly with
hello
I get the following output:

/home/robert/bin/scsh/hello
/home/robert/bin/scsh/hello: !#: command not found
display: Unable to open file (Hello World\n) [No such file or directory].

At this point,  Image Magick loads.  Image Magick is invoked with the
command "display."  Clearly,  bash,  not scsh,  is trying to execute the 
script.

Can anyone explain this?

Thanks,
Robert Morelli

<Prev in Thread] Current Thread [Next in Thread>