On 08May2006 14:48, Yogendra <[EMAIL PROTECTED]> wrote:
| Thanks Cameron, 
| Great help, but dunno I am stuck at 1 place. 
| 
| 
| Let say I have 3 scripts 
| 
| foo1.ksh 
| echo "foo 1"
| 
| foo2.ksh
| echo "foo 2"
| 
| foo3.ksh
| echo "foo 3"
| 
| AND now I am planning to call all 3 scripts from 1 script which can 
| run these all 3 scripts in Parallel SO according to you I wrote a new 
| file 
| 
| testfork.ksh
| 
| #!/bin/ksh
| foo1.ksh &
| foo2.ksh $
| foo3.ksh $
| 
| exit
| 
| 
| BUT ITS not working. 

Well without seeing the output of your test run I can only guess.
Please post the output, even if it is just an error message.

Basicly, you need to do two things to a shell script to use is like
a command: make it executable, an have it in a directory in your $PATH.

To make a script executable, go:

        chmod +rx the-script    # adds read+execute for you

or

        chmod a+rx the-script   # adds read+execute for everyone

You need read as well as execute because scripts are interpreted by
the shell; the binary executable that is run is actually the ksh (or
/bin/sh, depending on your script) executable, and it is handed your
script's pathname as argument. ksh opens the script and reads commands.
Because ksh is just a program like any other and running as you, it
needs read permission on the file.

A non-executabl script may be run by explicitly called ksh, thus:

        ksh foo1.ksh

which is fine while developing a script, but not what you want to do
in the general case.

You need the script in your $PATH so that the shell will find it.
When you type a command which does not have a full path, such as "ls",
your $PATH is searched for an executable. Likewise with your script,
you wish to use "foo1.ksh" etc as commands. They must be in your $PATH.

Normally you would have a personal directory for your own commands,
typically $HOME/bin, and would put things in there. You would ensure
$HOME/bin was in your $PATH.

To run an executable that is not in your $PATH you would normally
use its full pathname, eg:

        /usr/sbin/ifconfig -a

or if it is in your current directory (as your test scripts probably
are)
then you can use "./":

        ./foo1.ksh

Note: DO NOT put the current directory in your $PATH; it opens you up to
all manner of bad situations and is a very bad idea.

Cheers,
-- 
Cameron Simpson <[EMAIL PROTECTED]> DoD#743
http://www.cskk.ezoshosting.com/cs/

I strongly suspect so.  Practically everyone on sci.physics has a theory that
is far superior to special relativity, general relativity, quantum mechanics
*and* the standard model.  Around here, it's only a small clique of arrogant
young members of the physics establishment who fail to recognize these
revolutionary theories.  I'd explain why, but I have to go finish designing
my faster-than-light vacuum energy perpetual motion telekinetic
aether-powered time machine.    - John Baez


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Home is just a click away.  Make Yahoo! your home page now.
http://us.click.yahoo.com/DHchtC/3FxNAA/yQLSAA/0XFolB/TM
--------------------------------------------------------------------~-> 

To unsubscribe from this list, please email [EMAIL PROTECTED] & you will be 
removed. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/LINUX_Newbies/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to