Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #12032
| Path | csiph.com!xmission!news.glorb.com!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Piotr Grzybowski <narsil.pl@gmail.com> |
| Newsgroups | gnu.bash.bug |
| Subject | [patch] new special variable: test argument |
| Date | Wed, 16 Dec 2015 16:03:14 +0100 |
| Lines | 60 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.15.1450278199.843.bug-bash@gnu.org> (permalink) |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | multipart/mixed; boundary=001a11419202a35cdd05270534ce |
| X-Trace | usenet.stanford.edu 1450278199 14150 208.118.235.17 (16 Dec 2015 15:03:19 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | bug-bash <bug-bash@gnu.org> |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=8FPCoq6M22RLnGuyn1yIUY2TOMW/EC0edLQ8YxZZ7KM=; b=yI6I+o1o+XNV4+orODY7YqVgEWAiD4mudf2ibh7TOW29lVtEJoiGisEiKAGA6+LT5m Gjbn4Z1SKFAISJnXWb8f9mOE6vKfKQIsHvOr9SQ/AHZCNCBQZVSODqhKeDRvds0chcea ymjxm1/sc70xUiCon5AIuLy0YFblwE0bfrTiXticxqffY3iTc+G2Pa2gxrxMiH8XdL/U oi4bpa59ifQjme8C5nkkExZtjIO3LxxdIca9CoNG7S/Zib8oTVAyU9RIR5DHbYt8XSgC 67zJHgM/UJTFLeKeq9FUUqtsElQtWbWdDPthcND1ZTim1/ROjlxK/aiLPE8veMYoi36i ApOA== |
| X-Received | by 10.25.82.6 with SMTP id g6mr15404929lfb.135.1450278194947; Wed, 16 Dec 2015 07:03:14 -0800 (PST) |
| X-detected-operating-system | by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] |
| X-Received-From | 2a00:1450:4010:c07::232 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.14 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <http://lists.gnu.org/archive/html/bug-bash> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| Xref | csiph.com gnu.bash.bug:12032 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Dear All,
one thing I missed for some time now, is the ability to access the
argument passed to test, or any argument on the right hand side.
I needed it so I made a quick hack, which I attach as a reference.
It allows to access arg in the the -f $arg easily, e.g.:
[ -f /tmp/myfile ] && { echo "$^ is here"; head -1 "$^"; }
I would be glad for some feedback. What I have in mind is: make $^ a
special all-purpose variable, something in the lines of perls $_ .
The name '^' is just a first pick, and the implementation is a proof
of concept more than complete patch, which I would like to make
complete, if you find this of any interest .
cheers,
pg
Back to gnu.bash.bug | Previous | Next | Find similar
[patch] new special variable: test argument Piotr Grzybowski <narsil.pl@gmail.com> - 2015-12-16 16:03 +0100
csiph-web