in reply to interpolate using backticks?
This will fork a process; in the parent, the exec isnt going be executed, as the return of the open will be the PID of the child, and the child will just exec du with the content of $dir as first arg, without passing anything through a shell. In the previous example, it would give you an error: du: mail;touch jejejej: No such file or directory Yes, its more complex, and you may think its unnecessary in your current application, but its better to know a safer way to do it and the risks of the "unsafe" way, to have it in mind if, say, you end up attaching this to a CGI or something. Good luckmail; touch jejejejeje <code> as the input A safer, but more convoluted, way to do this is using open with "-|": <code>open (DA, "-|") || exec "du", "$dir"; @output = <DA>;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: interpolate using backticks?
by djw (Vicar) on Sep 21, 2000 at 15:52 UTC |