Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 15, 2013, 11:03 AM   #1
Petros Syntelis
macrumors newbie
 
Join Date: Jul 2013
tcsh script problem

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

Quote:
#!/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
Quote:
chmod 777 script.sh
and when i run in terminal
Quote:
$./script.sh
It returns
Quote:
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
Quote:
$tcsh
>setenv SSW /usr/local/ssw
>....
Type <sswidlde> to start SSW IDL
>sswidlde
The program starts!

What is wrong with the script?
Petros Syntelis is offline   0 Reply With Quote
Old Jul 15, 2013, 03:33 PM   #2
chown33
macrumors 603
 
Join Date: Aug 2009
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
echo From SSW: $SSW_INSTR
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
From SSW: gen plastic impact ontology secchi eis xrt trace aia hmi chianti
sswidlde: Command not found.
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.
chown33 is offline   0 Reply With Quote
Old Jul 17, 2013, 06:33 PM   #3
mwb
macrumors newbie
 
Join Date: Jul 2011
It looks like SSW is expecting "sswidlde" via standard input. Does the following work?

Code:
...
echo sswidlde | source $SSW/gen/setup/setup.ssw
mwb is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
changed bash to tcsh in gui MAC OS 10.5.8 how to chage back to bash? Mac10.5.8USER OS X 0 Feb 3, 2014 04:45 PM
Apple script batch shell script prramesh Mac Programming 5 Sep 15, 2013 03:35 AM
tcsh to bash permanent change in terminal? JBsea Mac Basics and Help 4 Apr 13, 2013 12:45 PM
A little problem: Need to bypass shutdown script Ri-dog Mac Basics and Help 5 Jan 18, 2013 08:21 AM
Terminal Help - tcsh Aragornii OS X 10.8 Mountain Lion 2 Dec 20, 2012 08:30 PM

Forum Jump

All times are GMT -5. The time now is 05:45 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC