Changes

Jump to: navigation, search

Talk:Fall 2008 SPR720 Sample Exam Questions

409 bytes added, 09:20, 11 December 2008
no edit summary
13. What command would you use to set the permission on a script so that only the script's owner could execute it? All other users should have no access to the script.
===14. Write the correct bash syntax to run the command "foo", taking the input from the file "hot", placing the output in the file "cold", and placing error message in the file "warm".===ANSWER: cat < hot > cold 2>warm (I use cat instead of "foo") ''PopCon''
===15. Write the correct bash syntax to run the command "bar", taking the input from the file "up", and sending the output and error messages to the command "baz".=== cat < up > baz 2>&1 (again I use cat instead of "bar")
16. Write a bash script to display all of the odd numbers from 1 to 99 with one space between each number.''PopCon''
===16. Write a bash script to display all of the odd numbers from 1 to 99 with one space between each number.===ANSWER: #!/bin/bash for ((A=1; A<=99; A+=2)) do echo -n $A" " done ''PopCon'' ===17. Describe what the PATH environment variable does. Write the syntax to add the directory "/usr/local/bin" to the PATH as the first directory searched.===ANSWER:Nes: PATH is a variable that tell where the shell what path to search when a command was requested to run. <pre>PATH=$PATH:/usr/local/bin</pre>
===18. What will this command do to the existing file "ocean"? date >ocean===

Navigation menu