Talk:Execute a system command

From Rosetta Code
Revision as of 18:00, 6 August 2009 by rosettacode>Kevin Reid (typo)

Shell command vs arguments array

I propose that we extend this task to include explicitly executing

  1. a "shell command", i.e. a string passed to an interpreter such as /bin/sh which parses it
  2. the command directly, i.e. specifying an array of arguments

(As applicable to the platform, of course; I'm thinking of this from a POSIX perspective.) The reason is that a common source of bugs is to use a "shell command" interface and fail to quote arguments which may have spaces in them, when the simple and reliable solution is to execute the command directly (POSIX exec(2)). It would therefore be good to promote awareness of the difference and knowledge of how to do either one as desired.

If there is agreement, I will revise the task to discuss this. --Kevin Reid 18:00, 6 August 2009 (UTC)