Re: $0 variation questions
- From: Bit Twister <BitTwister@xxxxxxxxxxxxxxxx>
- Date: Sun, 30 Jan 2011 23:29:14 +0000 (UTC)
On Sun, 30 Jan 2011 15:00:13 -0800, Todd wrote:
I mean the run line variables ($1 $2 etc.). And I was
mistaken. I thought $0 included then.
When in doubt, use echo $some_var_here or better yet
echo " >$some_var_here<" to detect any leading/trailing white space.
I still have to figure out how to get the
full path and name of the script.
You already know how to get name of script.
As you have seen, ./script_fn, bit you, and if you look at $PATH the
script could be in one or more places.
You can test first character for . and if so use $PWD.
Then run result through type. Here is a quick untested kludge
if [ "$_char1" = "." ] ; then
set -- $(type $0)
echo $_fn $_dir
- Prev by Date: Re: $0 variation questions
- Next by Date: Re: VLC: how NOT to get a maximized window
- Previous by thread: Re: $0 variation questions
- Next by thread: Re: $0 variation questions