Kirill Smelkov wrote: > On Tue, Jan 06, 2009 at 09:32:03PM +0100, martin f krafft wrote: > > I find this very confusing. Why not simply > > > > TG_PAGER="${GIT_PAGER:-}" > > TG_PAGER="${TG_PAGER:-$PAGER}" > > > > ? > > I find it confusing too, but this is needed because they usually do > something like this > > $ GIT_PAGER='' <some-git-command> > > to force it to be pagerless. [...] > So I think it would be better to preserve the same semantics for `tg > patch` callers, though it's a pity that it's hard (maybe I'm wrong ?) to > see whether an env var is unset. Admittedly I haven't really studied your patch, but the ${} constructs can in fact tell empty from unset: $ EMPTY= $ unset UNDEFINED $ echo ${UNDEFINED-foo} foo $ echo ${UNDEFINED:-foo} foo $ echo ${EMPTY-foo} $ echo ${EMPTY:-foo} foo 'man bash' indeed says When not performing substring expansion, bash tests for a parameter that is unset or null; omitting the colon results in a test only for a parameter that is unset. So I suppose you could use ${GIT_PAGER-${PAGER-less}} or similar. -- Thomas Rast trast@{inf,student}.ethz.ch
Attachment:
signature.asc
Description: This is a digitally signed message part.