APLawrence - Information and Resources for Unix and Linux Systems, Bloggers and the self-employed
RSS Feeds Get APLawrence.com by RSS













Linux Skills Test

© 2005 A.P. Lawrence

Answer


False

The second will fail, complaining "/bin/ls: invalid option -- "

It's the same as typing "ls '-l -R'" at the command line: the arguments get passed as ONE argument and "ls" gets confused. This is the kernel at work, not the shell. When it sees "#!", the first token after that becomes the pathname to be executed, and the rest is packed into argv[1] (argv[2] is the script filename).

Comments /Tests/Linux/e0880.html


Fri Sep 19 10:41:09 2008   anonymous


i tried this on terminal and both are working fine


Wed Jun 24 12:25:22 2009   Nenad


The previous comment on this question is not right.

Whatever guy in the previous comment tried, didn't do it right :) />


The answer is: FALSE



It's FALSE because it cannot work when put in the script.

You can try it by putting ls '-l -R' in the console.

this is the output:



# ls '-l -R'

/bin/ls: invalid option --

Try `/bin/ls --help' for more information.




Add your comments


Next question
Return to Question q0880

Related Articles

Have you tried Searching this site?

Please read this disclaimer

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.