Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
how to refer to basename of $0
- X-seq: zsh-users 16148
- From: TJ Luoma <luomat@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: how to refer to basename of $0
- Date: Thu, 28 Jul 2011 18:55:47 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; bh=sN4A+PMPJmOZa2caavulXtuHoDMZzpON839KDDLYBnA=; b=mahYM6SGkapcSPx4wSKWdAUig+B/EEb8u4dsKTvfn3601hsQd3S11lBOAOoon7hwFg WE2Mjd2tDoZLtVl9KlNCXxNK+9D2zZae3CG6LLNC7KADg24Ge4MegszrFa4910J+IKcp eyxzF4TPDUHrUIWNwaUiB0ynmFpaBqTgkugYQ=
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author