Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Petros Syntelis

macrumors newbie
Original poster
Jul 15, 2013
2
0
Hello guys,

I am having a peculiar problem and i can't find out what is problem. I have this script from my linux distribution

#!/bin/tcsh
setenv SSW /usr/local/ssw
setenv SSW_INSTR "gen plastic impact ontology secchi eis xrt trace aia hmi chianti"
source $SSW/gen/setup/setup.ssw
sswidlde

At the source line, the program asks for the user to type sswidlde to begin the GUI of a program called IDL.

so, i have give the
chmod 777 script.sh

and when i run in terminal
$./script.sh
It returns
Type <sswidlde> to start SSW IDL
(the printed message from the source command). But it does not begin.


Now, if run the script line by line in the terminal, as
$tcsh
>setenv SSW /usr/local/ssw
>....
Type <sswidlde> to start SSW IDL
>sswidlde

The program starts!

What is wrong with the script?
 

chown33

Moderator
Staff member
Aug 9, 2009
10,751
8,425
A sea of green
Exactly what is in your /usr/local/ssw/gen/setup/setup.ssw?


I did the following:

First, I created the necessary directory:
Code:
mkdir -p /usr/local/ssw/gen/setup

Next, I created a placeholder setup.ssw file:
Code:
echo "echo From SSW: \$SSW_INSTR" >/usr/local/ssw/gen/setup/setup.ssw

Then I confirmed it was what I expected:
Code:
cat /usr/local/ssw/gen/setup/setup.ssw
[I]echo From SSW: $SSW_INSTR[/I]

I created a file in the current dir, containing exactly what you posted:
Code:
#!/bin/tcsh
setenv SSW /usr/local/ssw
setenv SSW_INSTR "gen plastic impact ontology secchi eis xrt trace aia hmi chianti"
source $SSW/gen/setup/setup.ssw
sswidlde

I made it executable:
Code:
chmod a+x script.sh
Then I executed it (the output is in italics):
Code:
./script.sh
[I]From SSW: gen plastic impact ontology secchi eis xrt trace aia hmi chianti
sswidlde: Command not found.[/I]

This output is exactly what I would expect, given the placeholder I used. However, it does illustrate that script.sh is not causing the problem, because the 'source' command is clearly working correctly: it runs and returns. When it returns, the 'sswidlde' is the next command, but that command doesn't exist here (since the placeholder did nothing to install it).


Also, I don't follow the logic of telling the user to type in a 'sswidlde' command manually, when the shell script actually contains that command. It makes no sense. What are you trying to accomplish with 'script.sh'? Do you really intend to run setup.ssw every time?

Maybe I'm misunderstanding what you're trying to say. Or maybe the contents of setup.ssw needs to be looked at, so everyone understands what it should be doing.
 

mwb

macrumors newbie
Jul 21, 2011
26
17
It looks like SSW is expecting "sswidlde" via standard input. Does the following work?

Code:
...
echo sswidlde | source $SSW/gen/setup/setup.ssw
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.