Sanal
September 2, 2011, 8:25am
1
Hi,
Requirement:-
I have 3 scripts(say A.sh,B.sh & C.sh).Now am executing these 3 scripts seperately.requirement is to run these 3 scripts as single from one main script,this script has to call A.sh and if A.sh executed completely,it has to invoke B.sh and like the 3 rd one.And while executing the 2nd script its asking one prompt
(eg:-Do you really want to rename(enter YES or NO)? ),there "YES" has to enter...how will this implement.please help...
clx
September 2, 2011, 8:33am
2
Just put the scripts in the main script like you run from the command prompt.
All would be executed serially.
#! /usr/bin/ksh
/path/to/A.sh
/path/to/B.sh
/path/to/C.sh
About the prompt, Its not clear where you want to prompt? Is it inside script B.sh or in main script?
Where-ever it is, that should be something like below
echo -n "Do you really want to rename - YES/NO?"
read answer
if [ "$answer" = "YES" ]; then
# steps
fi
jerold
September 2, 2011, 8:38am
3
sanal:
Hi,
Requirement:-
I have 3 scripts(say A.sh,B.sh & C.sh).Now am executing these 3 scripts seperately.requirement is to run these 3 scripts as single from one main script,this script has to call A.sh and if A.sh executed completely,it has to invoke B.sh and like the 3 rd one.And while executing the 2nd script its asking one prompt
(eg:-Do you really want to rename(enter YES or NO)? ),there "YES" has to enter...how will this implement.please help...
I needed in past something like.... but:
Write script_1.sh and then inside it :
Xterm -e " . /script_2 ; killall xterm ; "
Xterm -e " . /script_3 ; killall xterm ; "
Xterm -e " . /script_4 ; killall xterm ; "
....
I hope this helps.
jgt
September 2, 2011, 9:27am
4
if [ "$answer" = "YES" ]; then
# steps
fi
I would be more inclined to reverse the condition to:
if [ "$answer" != "YES" ]; then
exit 1
fi
While both work, I find that matching "if",s and "fi", that extend over a page or so of code to be error prone.
1 Like
Hi Sanal
You can try this also..
Call first script in mail script (A.sh)
put B.sh in last line of A.sh , and likewise C.sh
If A.sh ran it will call B.sh and likewise...
Main Script
A.sh
B.sh
C.sh
hope it helps
Atul
Sanal
September 4, 2011, 10:59pm
6
thanks all for helping.....