From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: how to refer to basename of $0
Date: Fri, 29 Jul 2011 15:30:42 -0700 [thread overview]
Message-ID: <110729153042.ZM25377@torch.brasslantern.com> (raw)
In-Reply-To: <alpine.LNX.2.01.1107291003040.18508@hp.internal>
On Jul 29, 10:08am, Benjamin R. Haskell wrote:
} Subject: Re: how to refer to basename of $0
}
} On Fri, 29 Jul 2011, Tomasz Moskal wrote:
}
} > On Thu, 2011-07-28 at 21:04 -0700, Bart Schaefer wrote:
} >> On Jul 28, 9:39pm, TJ Luoma wrote:
} >> }
} >> } Is it even possible to set NAME in .zsh* (and have it return
} >> } 'test.zsh' or are they called too early in the process?
} >>
} >> This is sounding awfully familiar. Oh, it was on zsh-workers, where
} >> some of the -users crowd would not have seen it.
} >
} > Thanks for the links, but I am still baffled - basename $0 is
} > working here without any problems:
}
} The point wasn't quite the same (didn't involve "source"-ing .zshenv).
} $0 doesn't work if used inside startup files (.zshenv/.zshrc/.zprofile).
} When you source it manually, it's not treated specially.
}
} Just wanted to note that the '%x' that I pointed out does work, though:
}
} ## as the first line of .zshenv (so, will be run when starting zsh)
} $ sed 1q ~/.zshenv
} echo in .zshenv 0=$0 %x=${(%):-%x}
And I just wanted to point out that ${(%):-%x} doesn't solve the problem
being discussed in the zsh-workers thread I referenced; in the workers
thread the desire is to find the name of the calling script, which has
not yet been assigned to $0 at the time .zshenv is read.
This led to the patch proposed here:
http://www.zsh.org/mla/workers/2011/msg00180.html
-- which has not yet been applied, the discussion having broken off at
this point:
http://www.zsh.org/mla/workers/2011/msg00183.html
next prev parent reply other threads:[~2011-07-29 22:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-28 22:55 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 [this message]
2011-07-30 19:43 ` Greg Klanderman
2011-07-29 3:05 ` TJ Luoma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=110729153042.ZM25377@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).