El 19/12/2015 03:46, "Stephane Chazelas" <stephane.chaze...@gmail.com> escribió: > > 2015-12-19 00:58:41 +0100, Piotr Grzybowski: > > [..] > > Without $^ it begins to look terrible. > > Using a variable is the most obvious thing to do.
not always practical. > > Also, what if "new_index" was a function which does call "[ -f" > on another file? I removed much of the code, just to give you an idea it was not a working example. > > #2 > > touch /tmp/`date +%s`; if [ -f /tmp/`date +%s` ]; then echo "ok: $^"; fi; > > [..] > Again, use a variable. Not using a variable is even wrong here, > as those two calls of "date" could return a different result. it was just an example of something that yelds different result, exactly, and exactly the variable is the answer, only if using a variable introduces useless complication a special variable is the best answer. > > -- > Stephane > >