Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Undoing mv foo.txt{,_}



 ❦  6 septembre 2016 19:04 CEST, René Wilhelm <rene.wilhelm@xxxxxxxxx> :

> What's a good way to move file.txt_ back to file.txt, or more general: how
> to remove the suffix of a string, without putting it in a variable first
> (e.g. a=foo.txt; mv $a $a:r)?

About not using a variable, there is the ${:-...} pattern:

echo ${${:-foo.txt}:r}
-- 
Make sure all variables are initialised before use.
            - The Elements of Programming Style (Kernighan & Plauger)



Messages sorted by: Reverse Date, Date, Thread, Author