[clug] Pointless time-wasting bash questions

Paul Harvey csirac2 at gmail.com
Thu Jun 25 23:06:30 MDT 2015


On 26 Jun 2015 15:00, "Scott Ferguson" <scott.ferguson.clug at gmail.com>
wrote:
>
> On 26/06/15 14:21, Paul Harvey wrote:
> >> If I was to use it for real work I'd "eval ''". e.g.:-
> >> for i in /GenericAgent. . ; do eval cp 'Kernel/Config${i}pm{.dist,}' ;
done
> >
> > Is the eval necessary?
>
> If the code is used for shortening file names in various directories -
> and there is the possibility those names contains spaces. Then it would
> 'seem' necessary.

I used to use eval for this too, but forced myself to rewrite them without.
I'm pretty sure something like:

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

Would do the same thing, safely, without eval.

I'll test it later when I'm back in front of a computer


More information about the linux mailing list