On 12/16/2013 05:10 PM, Pádraig Brady wrote: > On 12/16/2013 02:53 PM, Bernhard Voelker wrote: >> The check is quite rough anyway because nothing prevents >> a user from writing a command after the redirection: >> >> u="$(</etc/passwd head -n1 | cut -d: -f1)" >> >> However, I think such use is very rare. > > Well not really. You could easily have $(<file tr blah BLAH) for example.
Sure, but this is a valid command. It is only unportable to have a command which is redirection-only, i.e. a command which does not execute another program. > While this could be reordered, I suppose the re should only match > there is no space or no | after the initial name. Hmm, catching spaces is a bit harder, because x="$(< 'file name' tr blah BLAH)" x="$(<'file name' tr blah BLAH)" x="$(<file\ name tr blah BLAH)" are all okay while x="$(< 'file name')" x="$(<'file name')" x="$(<file\ name)" are not. > I suppose we should also handle `< file`. Good point. Have a nice day, Berny