while(<>) { chomp; my $filename = $_; $filename =~ s/\$/\\\$/g; $filename =~ s/ /\ /g; $filename =~ s/\'/\\\'/g; print $filename ."\n"; my $exec = `md5sum $filename`; print $exec ."\n"; }
Now if I quote $filenamefind /tmp/ -type f | ./hash.pl <br> /tmp/File Wasn\'t found.txt <br> md5sum: /tmp/File: No such file or directory<br> md5sum: Wasn't: No such file or directory<br> md5sum: found.txt: No such file or directory<br> <br>
while(<>) { chomp; my $filename = $_; $filename =~ s/\$/\\\$/g; $filename =~ s/ /\ /g; $filename =~ s/\'/\\\'/g; print $filename ."\n"; my $exec = `md5sum '$filename'`; print $exec ."\n"; }
Any Ideias ? Thanksfind /tmp/ -type f | ./hash.pl /tmp/File Wasn\'t found.txt sh: Syntax error: Unterminated quoted string
In reply to Re^2: quoting/escaping file names
by famatte
in thread quoting/escaping file names
by famatte
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |