Re: $0 variation questions



On 2011-01-30, Todd wrote:
Hi All,

In bash scripting is there a way to get

1) just the name of the script, no path, no variables?

echo ${0##*/}

and

2) the name and path of the script only (no variables)?

echo $0


--
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)
.



Relevant Pages

  • Re: Heres how easy it is
    ... Closing the web browser is an event that can be detected in Javascript ... it is a version of Windows and one that includes taskkill.exe then you ... I normally want scripting enabled in the web browser because far too ... @echo off ...
    (alt.comp.anti-virus)
  • Re: PC Pitstop tests?
    ... I don't know about an add-on to IE that lets the user quickly and easily ... Whether scripting is enabled or not for IE is a registry setting (but having ... @echo off ... So I don't have an add-on for disabling/enabling scripting in IE but a ...
    (alt.comp.hardware.pc-homebuilt)
  • Re: How to block these Facebook and Twitter widgets?
    ... You'll have to disable scripting to make them go ... variable) and the batch file is called noscriptIE.bat, ... @echo off ... so prevalent in web pages that carte blanch disabling of scripting in ...
    (microsoft.public.windowsxp.general)
  • Re: script misses chars in cmd line arg passed to it only when called from another script
    ... My knowledge of bash scripting ranges up to simple while and for loops, ... echo param1 is an empty string ... the last statement in the "add) case", where var1 contains a simple path ...
    (comp.unix.shell)
  • Re: Re (2): Beserk one-liner!
    ... echo 'bad extra', should show error? ... echo is just another command; the shell parses the command line and ... expanded to filenames that match, if there are any, otherwise they ... Shell Scripting Recipes: ...
    (comp.os.linux.misc)