Shell script invoking other shell scripts

Shell script invoking other shell scripts

Post by Kelvin Romrel » Fri, 23 May 1997 04:00:00




Quote:> What is the significance of placing a dot in front of a shell script ?
> ( I am using the KORN shell)

> Can anyone explain why my session gets terminated when I place a dot and
> why not when the dot is not placed ?

Invoking a ksh script with a dot means that it runs in the current process
rather than a separate process being forked or exec'd (I don't remember
which).  So when you get to an exit at the end of the script, it closes the
current process.  If you plan to invoke the script with a dot, you must
make sure that it does not have any exit statements in it.

The reason that scripts are invoked with a dot, it because that allows the
environment to be updated.  If I run a script, and the script does a cd and
sets some variables, when return is controlled to me, the environment
returns to what it was before I invoked the script.  If I invoke it with a
dot, then the changes are made to the current process, so they are
permanent.
--
Kelvin Romrell
ADP Custom Programming

 
 
 

Shell script invoking other shell scripts

Post by Bill Marc » Sat, 24 May 1997 04:00:00




Quote:

>What is the significance of placing a dot in front of a shell script ?
>( I am using the KORN shell)

The dot means that the script is executed in the current environment,
not in a subshell.

Quote:>Can anyone explain why my session gets terminated when I place a dot and
>why not when the dot is not placed ?

One of your scripts probably either contains an "exit" command, or closes
standard input, or does an "exec" to some other program.

--
Bill Marcum    bmarcum at iglou dot com

 
 
 

Shell script invoking other shell scripts

Post by Pete Houst » Tue, 03 Jun 1997 04:00:00



#What is the significance of placing a dot in front of a shell script ?
#( I am using the KORN shell)

That script is read and executed in the context of the current process
ie: no new shell is forked.

#Can anyone explain why my session gets terminated when I place a dot and
#why not when the dot is not placed ?

Presumably your individual jobs end with an explicit "exit" command
which, in the context of your master job will cause it to exit.

                        Pete

 
 
 

1. Invoking shell function, shell script or alias with only partial match?

Hi,

I am trying to simulate the GNOME mini-commander's behavior with a
normal shell. mini-commander allows prefix expansion. This allows
commands that start with a given string to be expanded. For example,
expanding "http://" to "netscape $1" causes a command like
"http://www.userfriendly.org/" to be executed as "netscape
http://www.userfriendly.org/".

This could probably be accomplished with a shell that can execute a
function before it issues a "file not found" error. Can this be done
with bash (preferred) or a different free shell like zsh?

Any hints will be appreciated, thanks.

Greetings
Marc

--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | Mailadresse im Header
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29

2. Inconsistency in changing the state of task ??

3. handling SIGINT in shell scripts when executing another shell script.

4. Help Wanted: Iomega Zip Setup

5. Q: How can I have a shell script call another shell script...

6. Configuring Apache 2.0.40 - specifical issues

7. Convert Bash shell script to Korn shell script

8. advice on 3.1.5 restore from image backup

9. Shell Script Help (C-Shell Script)

10. How to pass a variable from a shell script to another shell script...

11. Shell script acting as interactive shell - $0 not script name??

12. shell script within shell script (general question)

13. hpw to invoke ftp from a Unix shell script