Is it possible to do this


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Is it possible to do this
# 1  
Old 04-05-2005
Is it possible to do this

Is it possible to "call and run" another script inside a script?

So say I had a script right now ... is it possible to enter in a code that will call&run another script?

I currently created 2 simple scripts.

1st script
=======
- takes number of users
- records number of users & time in a log file (log.txt)

2nd script
=======
- tells you if a user is currently logged on

I wanna use my 2nd script to append the log.txt of my 1st script so it will tell me if I am online at the moment. Is that possible to do?
# 2  
Old 04-05-2005
Say your scripts are script1.sh and script2.sh

Calling can done in this way.

Inside script1.sh, you should have the lines:

Code:
sh script2.sh

This assumes you run on /bin/sh.

The rest of script1.sh will run after script2.sh is done.

Cheers,
vino
# 3  
Old 04-05-2005
you just need to call the script like any other command...

Code:
comand
comand

/full/path/to/script.sh

command
command

# 4  
Old 04-05-2005
Recommended reading: Advanced Bash-Scripting Guide
# 5  
Old 04-06-2005
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question