Find the answer to your Linux question:
Results 1 to 4 of 4
-------------------------------------------------------------------------------- Hi, I'm trying to call a shell script from within another scipt, but returns with a `command not found` error msg. script_name=$1 ./$script_name &; exit 0 I think its ...
  1. #1
    Just Joined!
    Join Date
    Jun 2008
    Posts
    58

    Question calling a script

    --------------------------------------------------------------------------------

    Hi,

    I'm trying to call a shell script from within another scipt, but returns with a
    `command not found` error msg.


    script_name=$1
    ./$script_name &; exit 0
    I think its something to no with the "./" bit.

    i also tried
    "./"$script_name &; and
    "./$script_name" &
    no luck.


    Cheers
    David

  2. #2
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568
    Did you try with absoulte path name? like
    /complete/path/to/script.sh
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

  3. #3
    Linux User
    Join Date
    Nov 2009
    Location
    France
    Posts
    292
    Is your script executable ? (I guess so.)
    Does its name contain white spaces ? (You should quote the variable.)
    0 + 1 = 1 != 2 <> 3 != 4 ...
    Until the camel can pass though the eye of the needle.

  4. #4
    Just Joined! sixdrift's Avatar
    Join Date
    Jan 2007
    Location
    In and around and about Cary, NC
    Posts
    44
    Make sure the script has the executable bit set. And to be consistent make sure it has a she-bang in the first line. Something like:

    #!/bin/bash

    That is, assuming you are trying to execute bash. If it is a different script language, put in the appropriate interpreter command instead of bash.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...