<p>How does unix handle full path name with space and arguments ?<br>
In windows we quote the path and add the command-line arguments after, how is it in unix?</p>

<pre><code> "c:\foo folder with space\foo.exe" -help
</code></pre>

<p><strong>update:</strong></p>

<p>I meant how do I recognize a path from the command line arguments.</p>

[{'answer_id': 50798, 'author': 'Kyle Cronin', 'author_id': 658, 'author_profile': 'https://Stackoverflow.com/users/658', 'pm_score': 4, 'selected': False, 'text': '<p>You can quote if you like, or you can escape the spaces with a preceding \\, but most UNIX paths (Mac OS X aside) don\'t have spaces in them.</p>\n\n<pre><code>/Applications/Image\\ Capture.app/Contents/MacOS/Image\\ Capture\n\n"/Applications/Image Capture.app/Contents/MacOS/Image Capture"\n\n/Applications/"Image Capture.app"/Contents/MacOS/"Image Capture"\n</code></pre>\n\n<p>All refer to the same executable under Mac OS X.</p>\n\n<p>I\'m not sure what you mean about recognizing a path - if any of the above paths are passed as a parameter to a program the shell will put the entire string in one variable - you don\'t have to parse multiple arguments to get the entire path.</p>\n'}, {'answer_id': 50804, 'author': 'Fernando Barrocal', 'author_id': 2274, 'author_profile': 'https://Stackoverflow.com/users/2274', 'pm_score': 1, 'selected': False, 'text': '<p>You can quote the entire path as in windows or you can escape the spaces like in: </p>\n\n<pre><code>/foo\\ folder\\ with\\ space/foo.sh -help\n</code></pre>\n\n<p>Both ways will work!</p>\n'}, {'answer_id': 50805, 'author': 'Paige Ruten', 'author_id': 813, 'author_profile': 'https://Stackoverflow.com/users/813', 'pm_score': 5, 'selected': False, 'text': '<p>You can either quote it like your Windows example above, or escape the spaces with backslashes:</p>\n\n<pre><code> "/foo folder with space/foo" --help\n /foo\\ folder\\ with\\ space/foo --help\n</code></pre>\n'}, {'answer_id': 50811, 'author': 'zigdon', 'author_id': 4913, 'author_profile': 'https://Stackoverflow.com/users/4913', 'pm_score': 2, 'selected': False, 'text': '<p>Since spaces are used to separate command line arguments, they have to be escaped from the shell.  This can be done with either a backslash () or quotes:</p>\n\n<pre><code>"/path/with/spaces in it/to/a/file"\nsomecommand -spaced\\ option\nsomecommand "-spaced option"\nsomecommand \'-spaced option\'\n</code></pre>\n\n<p>This is assuming you\'re running from a shell.  If you\'re writing code, you can usually pass the arguments directly, avoiding the problem:</p>\n\n<p>Example in perl.  Instead of doing:</p>\n\n<p><code>print("code sample");</code>system("somecommand -spaced option");</p>\n\n<p>you can do</p>\n\n<p><code>print("code sample");</code>system("somecommand", "-spaced option");</p>\n\n<p>Since when you pass the system() call a list, it doesn\'t break arguments on spaces like it does with a single argument call.</p>\n'}, {'answer_id': 50830, 'author': 'Jason Cohen', 'author_id': 4926, 'author_profile': 'https://Stackoverflow.com/users/4926', 'pm_score': 2, 'selected': False, 'text': '<p>Also be careful with double-quotes -- on the Unix shell this expands variables.  Some are obvious (like <code>$foo</code> and <code>\\t</code>) but some are not (like <code>!foo</code>). </p>\n\n<p>For safety, use single-quotes!</p>\n'}, {'answer_id': 29418681, 'author': 'atwixtor', 'author_id': 435596, 'author_profile': 'https://Stackoverflow.com/users/435596', 'pm_score': 0, 'selected': False, 'text': "<p>If the normal ways don't work, trying substituting spaces with <code>%20</code>.</p>\n\n<p>This worked for me when dealing with SSH and other domain-style commands like <code>auto_smb</code>.</p>\n"}, {'answer_id': 41442709, 'author': 'PintoUbuntu', 'author_id': 3727642, 'author_profile': 'https://Stackoverflow.com/users/3727642', 'pm_score': 1, 'selected': False, 'text': '<p>I would also like to point out that in case you are using command line arguments as part of a shell script (.sh file), then within the script, you would need to enclose the argument in quotes. So if your command looks like</p>\n\n<pre><code>&gt;scriptName.sh arg1 arg2\n</code></pre>\n\n<p>And arg1 is your path that has spaces, then within the shell script, you would need to refer to it as "$arg1" instead of $arg1</p>\n\n<p><a href="https://unix.stackexchange.com/questions/131766/why-does-my-shell-script-choke-on-whitespace-or-other-special-characters">Here are the details</a></p>\n'}]
['https://Stackoverflow.com/questions/50794', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2566/']