4 ms·
> You can run a command with one line of code without the possibility of confusion with `system("ls", "-l", $dir)` $dir = '-r'; You loose. Quoting is not eno
by dolmen 6y ago
> You can run a command with one line of code without the possibility of confusion with `system("ls", "-l", $dir)`
$dir = '-r';
You loose.
Quoting is not enough. You also have to fully understand the syntax of each command.
Fix: system("ls", "-l", "--", $dir)
- dale_glass 6y agoBad example, yes. Plus it's a pointless thing to do to start with, because you run into trouble with special characters in filenames that way. Got to use readdir. And while we're being pedantic, it's 'lose'.
- dolmen 6y ago> And while we're being pedantic, it's 'lose'. Fair. I'm better at shell and Perl languages than English. None of them are my mother tongue.