Skip to main content
Fixed quoting
Source Link
terdon
  • 252.2k
  • 69
  • 480
  • 718

The simplest way is to modify your script to make it print its name and argument list to standard output. For example, if the file of your script contains echo $0 $@ as the first line, it will print the info you need (assuming it uses sh and is launched from bash):

#!/bin/sh
echo $0"$0 $@$@"

and then you can just redirect stdout to file, tee or whatever you want.

The simplest way is to modify your script to make it print its name and argument list to standard output. For example, if the file of your script contains echo $0 $@ as the first line, it will print the info you need (assuming it uses sh and is launched from bash):

#!/bin/sh
echo $0 $@

and then you can just redirect stdout to file, tee or whatever you want.

The simplest way is to modify your script to make it print its name and argument list to standard output. For example, if the file of your script contains echo $0 $@ as the first line, it will print the info you need (assuming it uses sh and is launched from bash):

#!/bin/sh
echo "$0 $@"

and then you can just redirect stdout to file, tee or whatever you want.

Source Link

The simplest way is to modify your script to make it print its name and argument list to standard output. For example, if the file of your script contains echo $0 $@ as the first line, it will print the info you need (assuming it uses sh and is launched from bash):

#!/bin/sh
echo $0 $@

and then you can just redirect stdout to file, tee or whatever you want.