tcsh script problem

Discussion in 'Mac Programming' started by Petros Syntelis, Jul 15, 2013.

  1. macrumors newbie

    #1
    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

    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
    and when i run in terminal
    It returns
    (the printed message from the source command). But it does not begin.


    Now, if run the script line by line in the terminal, as
    The program starts!

    What is wrong with the script?
     
  2. macrumors 603

    #2
    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.
     
  3. mwb
    macrumors newbie

    #3
    It looks like SSW is expecting "sswidlde" via standard input. Does the following work?

    Code:
    ...
    echo sswidlde | source $SSW/gen/setup/setup.ssw
    
     

Share This Page