Help with shell scripts 
Author Message
 Help with shell scripts

I need to know if there is any way to create and call libraries with
user defined functions from one script.

I work with unix HP-UX10

I make many shell scripts and I have several functions pre-defined that
I use, but I have to include them in all the scripts i write, and want
to know if there is a way to create a library that i can call from those
scripts.

Luis Filipe Reis



Tue, 07 Mar 2000 03:00:00 GMT  
 Help with shell scripts


: I need to know if there is any way to create and call libraries with
: user defined functions from one script.
:
: I work with unix HP-UX10
:
: I make many shell scripts and I have several functions pre-defined that
: I use, but I have to include them in all the scripts i write, and want
: to know if there is a way to create a library that i can call from those
: scripts.

Put all your scripts in one file (e.g. $HOME/lib/sh.incl) as functions
func ( )
  {
  ...
  }
and include the following in each script you want to access one of your
functions:
[ -r $HOME/lib/sh.incl ] && . $HOME/lib/sh.incl

But beware, putting a lot of functions into that file doesn't really speed
up your scripts ...

And if you ty to run those scripts on another machine implies also to move
your include file to that machine. You WILL forget that, I tell you. :-)

Hannes

BTW, did anyone detect some stuff concerning awk in here? Just wondering ...
--
"Mon Dieu! My automobile has been eaten by rats!" exclaimed Ted, with
equal fluency in both languages.  -- B. Kliban

Johannes Gritsch, CA-IT, Vienna, Austria (not Australia)



Sun, 12 Mar 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help with shell scripts ???

2. HELP: sourcing shell scripts or functions to change env variables

3. Scheme Shell: Shell Scripting for the 90's

4. Scheme Shell: Shell Scripting for the 90's

5. Scheme Shell: Shell Scripting for the 90's

6. Scheme Shell: Shell Scripting for the 90's

7. Scheme Shell: Shell Scripting for the 90's

8. help for newbie: way to get the value of an awk variable in a shell script

9. Help in converting simple shell script.

10. expect script with shell script

11. Set expect script variables via a korn shell script

12. converting korn shell scripts to tcl scripts

 

 
Powered by phpBB® Forum Software