On 12/16/15 10:03 AM, Piotr Grzybowski wrote: > 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 "$^"; }
This seems like an issue of programming style more than anything else. If you have a string or similar that you would like to refer to more than once, use a variable for it. It would take perhaps half a dozen more characters to use an explicit variable here. If you want something that is similar to perl's `$_', I'd be interested in your thoughts, but this is of limited usefulness as it stands. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/