[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patch] new special variable: test argument
From: |
Piotr Grzybowski |
Subject: |
Re: [patch] new special variable: test argument |
Date: |
Sat, 19 Dec 2015 01:03:35 +0100 |
Dear Stephane,
thanks.
On Wed, Dec 16, 2015 at 7:36 PM, Stephane Chazelas
<stephane.chazelas@gmail.com> wrote:
> What's wrong with
>
> f=/tmp/myfile; [ -f "$f" ] && { echo "$f is here"; head -n 1 < "$f"; }
nothing. sometimes it is just not practical (see my answer to Chet's
comment) and sometimes you just want to get that argument given to
test.
>
> A few shells (es, zsh, others) have support for
> lambdas/anonymous functions which could be another alternative. [..]
ok, but that isnt that practial for me.
> [..]
> $_ as the last argument of the last command or history expansion
> are generic enough but having $^ as the last argument to test -f
> seems too specific (and obscure) to me and a waste of a special
> variable.
well, maybe, but dont you think it could help? a way to get all the
arguments given to all the test calls? what do you think of the two
examples in the reply to Chet's response?
sincerely,
pg
Re: [patch] new special variable: test argument, konsolebox, 2015/12/16