in reply to Re: TIMTOWTDI Challenge: Create a filename
in thread TIMTOWTDI Challenge: Create a filename
Hey!
% which touch /usr/bin/touch
Portability counts! You should make it more robust. Maybe with env...
`echo "#!/usr/bin/env touch $file" > tmp.sh`;
Of course, that's slower at runtime. Extra forks and all. Maybe precalculate it...
`echo "#!\$(which touch) $file" > tmp.sh`;
But really, sh is pretty weak. And we've already got perl anyway, right? So why not use it to its fullest incapacity?
`echo "#!/usr/bin/env perl -e 'system \"\$(which touch) $file\"'" > tm +p.pl`; system './tmp.pl';
Of course, that's getting pretty silly. And tedious. Obviously a little metaprogramming is called for to generate those expressions...
|
|---|