The UNIX and Linux Forums
Forum Home
Linux and Unix Man Pages
Search Forums
Search Community Posts
Today's Posts
Quick Links
Man Pages
RedHat Commands
OpenSolaris Commands
Linux Commands
SunOS Commands
FreeBSD Commands
All UNIX Man Pages
All Linux Man Pages
Full Man Repository
Login or Register to Ask a Question and Join Our Community
Search Forums
Show Threads .
Show Posts
Tag Search
Advanced Search
Quick Links
Contact Us
Forum Rules
Today's Posts
FAQ
Pictures & Albums
All Albums
Miscellaneous
What is My IP
Whois
Mark Forums Read
Shell Programming and Scripting
Is it possible to do this
Tags
shell scripts
Login to Discuss or Reply to this Discussion in Our Community
Thread Tools
Search this Thread
Top Forums
Shell Programming and Scripting
Is it possible to do this
#
1
04-05-2005
801238429
Registered User
10,
0
Join Date: Apr 2005
Last Activity: 5 April 2005, 1:59 PM EDT
Posts: 10
Thanks Given: 0
Thanked 0 Times in 0 Posts
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?
801238429
View Public Profile for 801238429
Find all posts by 801238429
#
2
04-05-2005
vino
Registered User
2,848,
14
Join Date: Feb 2005
Last Activity: 10 August 2018, 5:24 AM EDT
Location: Sydney, Down Under
Posts: 2,848
Thanks Given: 0
Thanked 14 Times in 14 Posts
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
vino
View Public Profile for vino
Find all posts by vino
#
3
04-05-2005
reborg
Administrator Emeritus
4,463,
16
Join Date: Mar 2005
Last Activity: 29 March 2012, 7:00 PM EDT
Location: Ireland
Posts: 4,463
Thanks Given: 0
Thanked 16 Times in 14 Posts
you just need to call the script like any other command...
Code
:
comand comand /full/path/to/script.sh command command
reborg
View Public Profile for reborg
Find all posts by reborg
#
4
04-05-2005
Ygor
Registered User
1,801,
116
Join Date: Oct 2003
Last Activity: 15 May 2015, 11:55 AM EDT
Location: 54.23, -4.53
Posts: 1,801
Thanks Given: 1
Thanked 116 Times in 101 Posts
Recommended reading:
Advanced Bash-Scripting Guide
Ygor
View Public Profile for Ygor
Find all posts by Ygor
#
5
04-06-2005
Omkumar
Registered User
22,
0
Join Date: Mar 2005
Last Activity: 22 September 2005, 7:41 AM EDT
Posts: 22
Thanks Given: 0
Thanked 0 Times in 0 Posts
Check out this thread.
https://www.unix.com/shell-programming-and-scripting/17900-exit-status-invoking-two-more-scripts-background.html
-Om
Omkumar
View Public Profile for Omkumar
Find all posts by Omkumar
Login or Register to Ask a Question
Previous Thread
|
Next Thread
Login or Register to Ask a Question
Member Badges and Information Modal
×