[clug] Pointless time-wasting bash questions

Scott Ferguson scott.ferguson.clug at gmail.com
Thu Jun 25 23:00:14 MDT 2015


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.

The uncertainty is why I make use of peer review.

> What if ${i} expands to something like:
> '; rm -rf $HOME/*; echo '

Then the code has been misapplied(?)

grep rm ~/.bashrc
 alias rm='rm -i'


> 
> I suppose it's possible your code there is immune from this style of
> thing, but I hate having to think so hard and reason about eval.
> 
> Perhaps I've just been over-exposed to bad perl code from the
> "meta-programming just means building eval strings" era :)
> .
> 

Some Perl has similarities to "the brown acid" of the Woodstock era?

Kind regards


More information about the linux mailing list