Re: $0 variation questions
- From: "Chris F.A. Johnson" <cfajohnson@xxxxxxxxx>
- Date: Sun, 30 Jan 2011 18:08:35 -0500
On 2011-01-30, Todd wrote:
On 01/30/2011 02:46 PM, Bit Twister wrote:
On Sun, 30 Jan 2011 14:25:11 -0800, Todd wrote:
Hi All,
In bash scripting is there a way to get
1) just the name of the script, no path,
_script_fn=$(basename $0)
Perfect. Thank you!
echo $_script_fn
no variables?
What do you mean by "no variables"?
In the script or the command line arguments $1, $2,...
if no variables in script, it would be
echo $(basename $0)
There's no need for an external command (see my previous post).
I mean the run line variables ($1 $2 etc.). And I was
mistaken. I thought $0 included then.
I still have to figure out how to get the
full path and name of the script.
You should have no need for that. If you do, you need to rethink
your script.
--
Chris F.A. Johnson, <http://cfajohnson.com>
Author:
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
.
- Follow-Ups:
- Re: $0 variation questions
- From: Todd
- Re: $0 variation questions
- References:
- Re: $0 variation questions
- From: Bit Twister
- Re: $0 variation questions
- From: Todd
- Re: $0 variation questions
- Prev by Date: Re: $0 variation questions
- Next by Date: Re: $0 variation questions
- Previous by thread: Re: $0 variation questions
- Next by thread: Re: $0 variation questions
- Index(es):
Relevant Pages
|