in reply to Re: quoting/escaping file names
in thread quoting/escaping file names
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: quoting/escaping file names
by Corion (Patriarch) on Sep 09, 2014 at 07:11 UTC | |
by afoken (Chancellor) on Sep 10, 2014 at 17:46 UTC | |
by ikegami (Patriarch) on Sep 18, 2022 at 21:15 UTC | |
by Anonymous Monk on Sep 19, 2022 at 07:19 UTC | |
by ikegami (Patriarch) on Sep 20, 2022 at 01:29 UTC | |
by ikegami (Patriarch) on Jun 12, 2023 at 16:43 UTC | |
|
Re^3: quoting/escaping file names
by Anonymous Monk on Sep 09, 2014 at 08:04 UTC | |
|
Re^3: quoting/escaping file names (Path::Tiny find/rule Digest::MD5 )
by Anonymous Monk on Sep 09, 2014 at 08:18 UTC |