How can be done coping files that have some suffix at the end, into same dir with the smallest command possible:
Example have directory containing files:
- cassandra.yml.example
- database.yml.example
- facebook.yml.example
- cache.yml.example
- system.yml.example
need to copy them and have names like this:
- cassandra.yml
- database.yml
- facebook.yml
- cache.yml
- system.yml
ve figured about such thing: for x in ./config/*.example; do cp $x ./config/
basename $x .example`; done – Vitaliy Yanchuk Dec 07 '12 at 12:12basename
call (at least with recent-enoughbash
):for x in ./config/*.example; do n=${x##*/}; cp $x dest/dir/${n%.example}; done
– peterph Dec 07 '12 at 12:59zmv '(*).example' '$1'
– Kevin Dec 08 '12 at 00:22