[clug] Pointless time-wasting bash questions

Duncan Roe duncan_roe at acslink.net.au
Sun Jun 28 04:26:03 MDT 2015

On Fri, Jun 26, 2015 at 07:06:38PM +1000, Alex Satrapa wrote:
> On 26 Jun 2015, at 16:15, Bob Edwards <Robert.Edwards at anu.edu.au> wrote:
> >
> > Again, the quotes aren't actually doing anything here (except in the
> > first instance above: you do need something to delimit the variable i
> > from the "pm", but it could just as easily be Config$i"pm" etc.)
> Just to prove that there is more than one way to do it, I prefer using Config${i}pm style. Then again, I learned Perl long before I learned any shell scripting.
> Alex
"$i" will protect against spaces in the expansion of $i, ${i} will not.

Be that as it may, you can further compactthe solution by omitting unnecessary
white space:

for i in /GenericAgent. .;do cp Kernel/Config"$i"pm{.dist,};done

Cheers ... Duncan.

More information about the linux mailing list