Originally Posted by keefaz
2. Yes it's fine to use as this as long as the shell has brace expansion (bash, sh, csh ..)
Mmmmmmmmm, well you might want to keep in mind that a classical Bourne shell sh
can do brace expansion somewhat differently than a fully "modern" bash
shell. I believe that there's even a mention of that somewhere in the bash manual page. Also, often running something like /bin/sh on Linux will actually result in running a form of bash.
That all is why I tried to stress
that what you suggest would work, if you are using the bash
Breaking down a command into its individual elements, and testing them separately, can be a rather simple way to understand what the overall command will do. That's why I illustrated what the brace expansion would be, using echo
commands. As keefaz mentioned, the result of the brace expansion is what's then passed to the mv
command. You can do the same sort of thing with a variety of patterns/expansions/etc., using the echo
command to see what the result of a pattern/expansion/etc will be, before using it in a more complete command. In that sense, the echo
command tends to allow for harmless investigation of what would happen, if you used something in the command you ultimately wish to execute.