Calling a shell script from within another shell script.

A 5 star hangout for overworked and underpaid system admins.
Post Reply
akothare77
Posts: 1
Joined: 2017/04/14 06:22:23

Calling a shell script from within another shell script.

Post by akothare77 » 2017/04/14 06:50:24

Hi All !

I am a relative newbee to Linux in general.

I have 2 shell scripts.

Script 1:
Sets some python env variables
Triggers a python script
The output of the above python script is redirected to a log file based on parameter passed in from Script2.

Script2:
Set some different variables.
Triggers Script1 with a parameter1
Triggers Script2 with a parameter2
Triggers Script3 with a parameter3.

I know individually Script1 is working fine and creates 'n' different log files, based on parameters passed to it.

However, when I trigger Script2 - I don't find any log files getting generated.

Am trying to google this, but am not able make much of a headway into this issue.

Could totally be a mistake on my part, but I dont really know.

Any help is appreciated.

Thanks and regards,
Akshay

drknut
Posts: 50
Joined: 2016/12/13 11:59:42

Re: Calling a shell script from within another shell script.

Post by drknut » 2017/04/15 22:52:50

you should post a MWE https://en.wikipedia.org/wiki/Minimal_Working_Example of what you are trying to achieve.

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: Calling a shell script from within another shell script.

Post by aks » 2017/04/18 17:41:49

Suspect your calling shell is "overwriting" the existing shell. Suggest you Google around subshells (i.e: lunch it in a new process)....

Post Reply