Results 1 to 6 of 6
OK Ive looked around but can't seen to find the answer.
I want to combine several scripts into one.
I can do it by putting all the scripts into 1 ...
- 08-14-2007 #1Linux Newbie
- Join Date
- Jun 2006
- Posts
- 139
EZ question on cmds and files
OK Ive looked around but can't seen to find the answer.
I want to combine several scripts into one.
I can do it by putting all the scripts into 1 file and execute it.
BUT can I have a script/file that executes all the scripts I want to combine?
thanks
mace
- 08-14-2007 #2Registered Linux user #270181
TechieMoe's Tech Rants
- 08-14-2007 #3Linux Newbie
- Join Date
- Jun 2006
- Posts
- 139
Thanks TM but now I have another question, which I should have asked before.
Each preceding scripts needs the previous script to finish( s1 is a shutdown, s2 is a backup/zip of s1, and s3 is the restarting of the db)
I know I can put a sleep in between each script name but that dosen't ensure the previous step finished.
How can I overcome this?
thanks
Mace
- 08-14-2007 #4Registered Linux user #270181
TechieMoe's Tech Rants
- 08-14-2007 #5
I experimented on this problem.
main.sh
first.shCode:#!/bin/bash ./first.sh ./second.sh exit
second.shCode:#!/bin/bash i=0 while [ "$i" -lt 3 ] do echo "first" sleep 2 i=`expr $i + 1` done
When I executed main.sh, output isCode:#!/bin/bash i=0 while [ "$i" -lt 3 ] do echo "second" sleep 2 i=`expr $i + 1` done
It means, second.sh got executed only when first.sh exited.Code:first first first second second second
It is amazing what you can accomplish if you do not care who gets the credit.
New Users: Read This First
- 08-15-2007 #6Linux Newbie
- Join Date
- Jun 2006
- Posts
- 139
Thank you. I'll give it a shot today
mace


Reply With Quote
