in reply to Re: Re: system, pipes, shell, quoting
in thread system, pipes, shell, quoting
(ahem) You mean you won't even try it? Pull down the "shloop" utility I referred to earlier, and try this (I just did):
(just to convince you that using single-quotes around a nasty string will help for some cases -- so long as the string doesn't include any single-quote characters) And then try this:echo '?*;&'
If that doesn't work for you, please let me know. I don't have access to a FreeBSD system, and I'd be interested to learn how different it could be from linux & solaris (where this works).mkdir /tmp/junk echo '?*;&' | shloop -e "touch '/tmp/junk/\i'" ls -l /tmp/junk
BTW, if your list of potential file names does happen to involve cases that include one or more quote-like characters, then you're right -- the above will not work. In such cases, let me suggest that you should only be facing this issue with existing file names that are created by other processes and are to be used as input to a given pipeline -- don't ever create such file names yourself for output. To handle these, open the the nasty-named file for input in perl (get the file name via "readdir" so you don't need to present such a name as a command-line arg -- who knows, maybe a file name could include a "\n"!), then open your pipeline as a file handle, and pass file data to the pipeline that way. E.g.:
I haven't tried that yet (but I think you should try it yourself before you say it won't work... ;^).opendir( DIR, "some_dir" ); @files = grep /[^.]/, readdir( DIR ); # skips "." and ".." # (assumes you never need to look for files named "...") foreach $file ( @files ) { next unless ( -f $file ); $outfile = "something_sane"; open( PIPE, "| $prog1 | $prog2 -x -y | $prog3 > $outfile" ); open( IN, "<", $file ); while (<IN>) { print PIPE; } close PIPE; close IN; # and/or unlink or rename that input file so it's less of a bother hen +ceforth }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: system, pipes, shell, quoting
by superpete (Beadle) on Nov 13, 2002 at 06:48 UTC | |
by superpete (Beadle) on Nov 13, 2002 at 06:59 UTC | |
|
Re: shells
by superpete (Beadle) on Nov 13, 2002 at 06:24 UTC | |
|
Re: Re: Re: Re: system, pipes, shell, quoting
by superpete (Beadle) on Nov 13, 2002 at 06:39 UTC | |
by graff (Chancellor) on Nov 13, 2002 at 07:22 UTC | |
by superpete (Beadle) on Nov 13, 2002 at 07:42 UTC |