cp -i aaa/bbb/ccc/ddd/xxxx_{6,7}.tpl
This expands to
cp -i aaa/bbb/ccc/ddd/xxxx_6.tpl aaa/bbb/ccc/ddd/xxxx_7.tpl
This feature of bash is called Brace Expansion and can ease versioning of files based on filesystem. If you have a sequence of files with versions assigned to them as incremented part of the name, you can easily create one more with the given command:
> ls
aaa/bbb/ccc/ddd/xxxx_4.tpl
aaa/bbb/ccc/ddd/xxxx_5.tpl
aaa/bbb/ccc/ddd/xxxx_6.tpl
> cp -i aaa/bbb/ccc/ddd/xxxx_{6,7}.tpl
> ls
aaa/bbb/ccc/ddd/xxxx_4.tpl
aaa/bbb/ccc/ddd/xxxx_5.tpl
aaa/bbb/ccc/ddd/xxxx_6.tpl
aaa/bbb/ccc/ddd/xxxx_7.tpl
Even nicer usage:
cp filename{,_`date '+%F'`}
Bash is awful.
ОтветитьУдалить