[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patch] new special variable: test argument
From: |
Piotr Grzybowski |
Subject: |
[patch] new special variable: test argument |
Date: |
Wed, 16 Dec 2015 16:03:14 +0100 |
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
0001-special-s6-variable.patch
Description: Binary data