[clug] Pointless time-wasting bash questions

Scott Ferguson scott.ferguson.clug at gmail.com
Thu Jun 25 03:29:36 MDT 2015


Messing with bracket contractions.

*1*.
cp Kernel/Config/GenericAgent.pm.dist Kernel/Config/GenericAgent.pm
I can shorten the process with:-
cp Kernel/Config/GenericAgent.pm{.dist,}

*2*. likewise
cp Kernel/Config.pm.dist Kernel/Config.pm
I can shorten the process with:-
cp Kernel/Config.pm{.dist,}

*3*. I can combine the two with:-
cp Kernel{/Config,/Config/GenericAgent}.pm{.dist,}

e.g.:-
echo Kernel{/Config,/Config/GenericAgent}.pm{.dist,}
Kernel/Config.pm.dist Kernel/Config.pm
Kernel/Config/GenericAgent.pm.dist Kernel/Config/GenericAgent.pm


Anyone know a more ergonomic process?
(extra points if it's easier to read)

Any dangers I may have overlooked?


Disclaimer: it 'might' not really a pointless exercise (but it's a way
of putting off less interesting work) as I've a similar task that could
use variables in place of "/Config" and ".dist" to deal with a wider
range of directory names and file extensions.


Kind regards




More information about the linux mailing list