HOw to call shell script within another shell script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting HOw to call shell script within another shell script?
# 1  
Old 01-11-2017
HOw to call shell script within another shell script?

Hi I am trying to call shell script within other shell script but gettting error: -
script 1.ksh is calling 2.ksh:-
1.ksh contains below code:-
Code:
#!/bin/bash
curl -k -c /home/code/cookies.txt  '/home/code/2.ksh';
minimumsize=215
actualsize=$(wc -c < "$1")
for (( i=1; i<=3; i++ ))
do
if [[ -s "$1" &&  $actualsize -lt $minimumsize ]] ||  [ ! -s "$1" ]
then
curl -k -c curl -k -c /home/code/cookies.txt  '/home/code/2.ksh';
fi
done

2.ksh contains below code:-
Code:
#!/bin/bash
Google


path for both 1.ksh and 2.ksh is /home/code

---------- Post updated at 02:16 AM ---------- Previous update was at 02:15 AM ----------

1.ksh contains below code:-
Code:
#!/bin/bash
curl -k -c /home/code/cookies.txt '/home/code/2.ksh';
minimumsize=215
actualsize=$(wc -c < "$1")
for (( i=1; i<=3; i++ ))
do
if [[ -s "$1" && $actualsize -lt $minimumsize ]] || [ ! -s "$1" ]
then
curl -k -c curl -k -c /home/code/cookies.txt '/home/code/2.ksh';
fi
done




2.ksh contains below code:-
Code:
#!/bin/bash
https://www.infa-u.com


Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!
And, removing the duplicate text would improve post readability tremendously.

Last edited by RudiC; 01-11-2017 at 04:50 AM.. Reason: Added CODE tags.
# 2  
Old 01-11-2017
What exactly are you trying to do? The second text is NOT a shell script. It does not contain interpretable code.
If it contained either of those URLs mentioned ONLY, you might succeed with a cat in a "command substitution". Make sure to use the $(...) form or the deprecated backticks, but not the single quotes that you placed the script name in.

And, trying to run above with the "shebang"s given will NOT use ksh as the interpreter, but bash.
# 3  
Old 01-11-2017
In 1.ksh I am trying to substitute value https://www.infa-u.com in place of /home/code/2.ksh

Last edited by rbatte1; 01-11-2017 at 06:25 AM.. Reason: corrected formatting
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell script to call and sort awk script and output

I'm trying to create a shell script that takes a awk script that I wrote and a filename as an argument. I was able to get that done but I'm having trouble figuring out how to keep the header of the output at the top but sort the rest of the rows alphabetically. This is what I have now but it is... (1 Reply)
Discussion started by: Eric7giants
1 Replies

2. Shell Programming and Scripting

Call a function in shell script from another shell script

I've 2 shell scripts viz., CmnFuncs.ksh and myScript.ksh. 1st script contains all common functions and its code is as below: $vi CmnFuncs.ksh #!/bin/ksh RunDate() { .... .... export Rundt=`date +%Y%m%d` } 2nd script is invoking the above one and I expect to use the RunDt variable... (8 Replies)
Discussion started by: njny
8 Replies

3. Shell Programming and Scripting

Shell script to call Oracle archive backup script when file system reaches threshold value

Hello All, I need immediate help in creating shell script to call archivebkup.ksh script when archive file system capacity reaches threshold value or 60% Need to identify the unique file system that reaches threshold value. ex: capacity ... (4 Replies)
Discussion started by: sasikanthdba
4 Replies

4. Shell Programming and Scripting

Correct shell script to Call One shell script from another shell script

Hi All, I have new for shell scripting. Problem : I have one scrip at serv1 and path of server is /apps/dev/provimage/scripts and script name:extract_ancillary.bat. I need to call this script at server2(my working server) and execute at server2 . Please let me know how to build the... (5 Replies)
Discussion started by: Vineeta Nigam
5 Replies

5. Red Hat

how to call a particular function from one shell another shell script

please help me in this script shell script :1 *********** >cat file1.sh #!/bin/bash echo "this is first file" function var() { a=10 b=11 } function var_1() { c=12 d=13 (2 Replies)
Discussion started by: ponmuthu
2 Replies

6. Shell Programming and Scripting

call another shell script and pass parameters to that shell script

Hi, I basically have 2 shell scripts. One is a shell script will get the variable value from the user. The variable is nothing but the IP of the remote system. Another shell script is a script that does the job of connecting to the remote system using ssh. This uses a expect utility in turn. ... (2 Replies)
Discussion started by: sunrexstar
2 Replies

7. Shell Programming and Scripting

shell script to call perl script problems

Ok, don't ask me why, but all calls to perl must be called by a shell script. Its really not ideal, but its what I have to work with. Calling it isnt the issue, its passing in the arguments. I have about 1000 perl scripts to call by a shell script. Right now, I'm executing the shell script... (3 Replies)
Discussion started by: regexnub
3 Replies

8. Shell Programming and Scripting

call shell script from perl cgi script problem

hi,, i have perl scipt with line : system('./try.sh $t $d $m'); in shell scipt try.sh i have the line: echo $1 its not printing value of $t that i hav passed..y is it so..i am running it from apache web server (2 Replies)
Discussion started by: raksha.s
2 Replies

9. UNIX for Dummies Questions & Answers

To call/execute a shell script from a shell script

Hi , I have 4 shell scripts a.ksh b.ksh -> depends on a.ksh success -> log into b.log c.ksh -> depends on b.ksh success -> log into c.log d.ksh -> depends on c.ksh success -> log into d.log I will have to write main.ksh ( execute a.ksh , log into a.log if a.ksh= success, execute... (1 Reply)
Discussion started by: konark
1 Replies

10. Shell Programming and Scripting

Have a shell script call another shell script and exit

I have a shell script that calls another shell script "str_process_main" that runs in a loop until a given time. I want the first script to just call the second one and then exit. The first script is: #!/bin/ksh DATE=$(date +%m%d%y) DPID=$(ps -ef|grep str_process_main|grep -v grep) if ;... (2 Replies)
Discussion started by: heprox
2 Replies
Login or Register to Ask a Question