zsh-users
 help / color / mirror / code / Atom feed
* how to refer to basename of $0
@ 2011-07-28 22:55 TJ Luoma
  2011-07-28 23:54 ` Tomasz Moskal
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: TJ Luoma @ 2011-07-28 22:55 UTC (permalink / raw)
  To: Zsh Users

I am trying to move a bunch of my scripts to zsh instead of bash
because I'm starting to run into little differences in the way things
are handled which are annoying, and I figured it made more sense to
just learn one way rather than two.

I have a ".source" file that I use to setup some functions and
variables for use in my scripts, and one of the things it does it
this:

NAME=`basename $0`

which, in bash, gives me the basename of the script. For example, if
the script "foo.sh" read .source like this:

	. $HOME/.source

and then I did

	echo "$NAME"

it would give me

	foo.sh

but in zsh I get

	zsh

Is there a way for me to get the equivalent of `basename $0` when
writing shell scripts in zsh?

(I hope this is understandable. If not, please let me know and I'll
try to rephrase.)

thanks for your time

TjL


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-07-30 19:51 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-28 22:55 how to refer to basename of $0 TJ Luoma
2011-07-28 23:54 ` Tomasz Moskal
2011-07-29  0:24 ` Phil Pennock
2011-07-29  1:30   ` Tomasz Moskal
2011-07-29  0:44 ` Benjamin R. Haskell
2011-07-29  1:39   ` TJ Luoma
2011-07-29  2:06     ` Tomasz Moskal
2011-07-29  4:04     ` Bart Schaefer
2011-07-29  4:50       ` TJ Luoma
2011-07-29 11:48       ` Tomasz Moskal
2011-07-29 14:08         ` Benjamin R. Haskell
2011-07-29 22:30           ` Bart Schaefer
2011-07-30 19:43             ` Greg Klanderman
2011-07-29  3:05   ` TJ Luoma

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).