Re: SHELL Dependency between scripts??

From: Adam Price (adam+usenet_at_pappnase.co.uk)
Date: 10/30/04

  • Next message: schranen: "Re: scripting sftp transfers"
    Date: Sat, 30 Oct 2004 17:06:16 +0100
    
    

    On 30 Oct 2004 07:40:50 -0700, qazmlp wrote:

    > I have the following scripts.
    > -------first.sh-------
    > #!/bin/csh
    >
    > setenv FIRST first
    > source second.sh
    > -------first.sh-------
    >
    > ------second.sh-------
    > #!/bin/ksh
    >
    > echo FIRST=$FIRST
    > export SECOND=second
    > -------second.sh------
    >
    > When I execute first.sh, the following error is reported:
    >
    > FIRST=first
    > export: Command not found
    >
    >
    > Why exactly 'export: Command not found' error is reported?
    > When second.sh is executed separately, it works fine. So, why should
    > the error be reported when it is invoked from a different script?
    >
    > Does this error indicate that, the shell used by all the shell scripts
    > has to be same, if the case is one script is used by another
    > script(s)?
    >
    > Kindly clarify!

    source is a c-shell directive which means execute the named file in the
    current shell.
    So when you try to run second.sh from first.sh you are running it with the
    csh interpreter.
    If you don't use source then it should work fine.
    Adam


  • Next message: schranen: "Re: scripting sftp transfers"

    Relevant Pages

    • Re: shell scripting
      ... and am assuming an sh-compatible shell here.... ... command 1 options arguments ... To run the script, do: ... then you need to use the full path to execute it: ...
      (comp.unix.questions)
    • Re: shell scripting
      ... and am assuming an sh-compatible shell here.... ... command 1 options arguments ... To run the script, do: ... then you need to use the full path to execute it: ...
      (comp.unix.shell)
    • Re: Script Header
      ... > On a shell script, ... > You can TRY to execute a garbage file. ... > filename: Exec format error. ... - The shell will check whether this file has the executable flag set, ...
      (comp.unix.shell)
    • Re: newbie question: cant get script to execute
      ... I saved this in a script "process.bsh". ... The typical name for a shell script it .sh, and this is not a shell ... > I chmod to 777 and still get "cannot execute". ... the error message is distinct and far ...
      (comp.lang.perl.misc)
    • Re: Access denied
      ... > Try changing your shell to /bin/sh and then try running the script from the ... >>> I can not run shell. ... >>That typically comes when trying to execute on non Linux filesystems. ... the partition with the "Access denied problem" is reiserfs ...
      (perl.beginners)