inclusion in a script shell

inclusion in a script shell

Post by Laurent Lev » Thu, 25 Dec 2003 22:16:14



hi all ,

I'm writing a lot of shell script(AIX ksh) which use some common functions.
but I did not manage to include a common file script into the others.

ex : I have the file common.sh and 2 other file s1.sh  and s2.sh
I tried to put " source common.sh" in the top of my others scripts but there
is no command "source" in aix.

could anyone help me to do this?

thanks to all.

Laurent

 
 
 

inclusion in a script shell

Post by Hanspeter 'Happl' Oberli » Fri, 26 Dec 2003 00:07:09



>I'm writing a lot of shell script(AIX ksh) which use some common functions.
>but I did not manage to include a common file script into the others.
>ex : I have the file common.sh and 2 other file s1.sh  and s2.sh
>I tried to put " source common.sh" in the top of my others scripts but there
>is no command "source" in aix.

. common.sh

source is there. It's a csh specific feature (and that's why it is
not in ksh or bsh).

Gruesse aus der Schweiz
Greetings from Switzerland
Salutation en provenance de Suisse
Happl

 
 
 

inclusion in a script shell

Post by Bill Marcu » Fri, 26 Dec 2003 00:19:34


On Wed, 24 Dec 2003 14:16:14 +0100, Laurent Levi

> hi all ,

> I'm writing a lot of shell script(AIX ksh) which use some common functions.
> but I did not manage to include a common file script into the others.

> ex : I have the file common.sh and 2 other file s1.sh  and s2.sh
> I tried to put " source common.sh" in the top of my others scripts but there
> is no command "source" in aix.

Use the command "." instead, or use bash instead of ksh.
Ksh also has a variable FPATH, which tells it where to look for functions.

--
Let the meek inherit the earth -- they have it coming to them.
                -- James Thurber

 
 
 

inclusion in a script shell

Post by Web Surfe » Fri, 26 Dec 2003 01:13:05


[This followup was posted to comp.unix.shell]


says...

Quote:> hi all ,

> I'm writing a lot of shell script(AIX ksh) which use some common functions.
> but I did not manage to include a common file script into the others.

> ex : I have the file common.sh and 2 other file s1.sh  and s2.sh
> I tried to put " source common.sh" in the top of my others scripts but there
> is no command "source" in aix.

> could anyone help me to do this?

> thanks to all.

> Laurent

Use the "." command as follows :

. common.sh

 
 
 

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

I have a simple shell script foo1.sh that invokes another shell script
foo2.sh, something like below:

#!/bin/sh
SIGINT_handler()
{
  echo "## [$DATE_TIME]  User interrupt ignored,"
  continue
trap SIGINT_handler 2

...
./foo2.sh
...

----------
while executing foo1.sh, if the script receives SIGINT, how do I ignore
the SIGINT in foo2.sh ? somehow foo2.sh does not finish to completion
and is killed after receiving SIGINT. but foo1.sh is still executing.
Is there any way to trap this signal in the child script. ? Please
share your thots and inputs on this topic.
Regards,
Vikram Shekhar

2. Laserjet 4 Printer always prints twice

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

4. Problems with custom kernel

5. Shell script invoking other shell scripts

6. SuSe 6.0, wvdial & pppd

7. Convert Bash shell script to Korn shell script

8. lp is not running, how to compile?

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. shell built ins