Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Can a bash script know which other script called it?


    If you have many scripts which may at some point run the script "foofoo.sh", and for some reason you want to keep track of this, is there a way to embed some code in the "foofoo" script so that it generates a log that would look something like:

    9:00 - autostart.sh - foofoo.sh parameters
    10:00 - cron - foofoo.sh parameters 2
    12:00 - fooscript.sh - foofoo.sh parameters
    15:00 - at - foofoo.sh parameters 3


    I know that "parameters" would be "$*" but I have no idea to know "who" called. The time it happened is eye-candy and I can easily solve it, I'm really interesting in knowing who called the script.

    Thanks.
    Openbox + tint2 desktop. Debian testing, liquorix kernel

  2. #2

  3. #3
    Thanks!

    Keyword to remember when searching for stuff like that, "built-in variable".
    Openbox + tint2 desktop. Debian testing, liquorix kernel

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •