12-12-2009, 04:49 AM
|
#16
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
|
Quote:
Originally Posted by theNbomr
Actually, isn't it the shell that break arguments on whitespace? If I launch a program from a shell, it builds the argc/argv parameters from whatever is specified on the commandline, and passes those to the launched program. The same applies if any other program launches with exec() (in one of its many flavors), another program. The parent builds up the argc/argv parameters, of which any number of argvs may contain whitespace, and those arguments will remain intact when the child process accesses them. I do not know of a single common application that then splits individual arguments on whitespace in the character arrays. Can you name any?
Proper use of quotes and escapes in the shell is a key concept to be learned when shell scripting.
--- rod.
|
+1 to that
|
|
|