LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to find out which shell script called? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-find-out-which-shell-script-called-848582/)

gurubbc 12-06-2010 12:07 AM

How to find out which shell script called?
 
Hi,

I have two shell scripts:

sh1.sh
======
echo "First script"
echo "Now calling second one"
sh2.sh

sh2.sh
======
echo "Second script"
In this shell script, I want to print out which shell script called this. In this case, sh1.sh called sh2.sh. So, I want to print out "sh1.sh".

How to achieve?

Thanks,

Disillusionist 12-06-2010 01:00 AM

man ps

check out parent processing id


All times are GMT -5. The time now is 06:24 AM.