IT 244: Introduction to Linux/Unix
Quiz 7 Answers

  1. If you wanted to run the executable file backup in your current directory, but wanted the error messages to disappear, what would you write at the command line?
    ./backup  2>  /dev/null
  2. If you wanted to run the executable file backup in your current directory, but wanted both the output and the error messages to go to the file results.txt, what would you write at the command line?
    ./backup  &>  results.txt
  3. What would you type at the command line, if you wanted to make the script cheer.sh executable?
    chmod  755 cheer.sh
  4. Write the hashbang line we use for scripts in this course.
    #! /bin/bash
  5. What command would you use to make the changes you made in the startup file for your login shell take effect?
    source .bash_profile
  6. What character would you use if you wanted to run two commands, one right after the other, on a single command line?
    ;
  7. What other two characters allow more than one command to be run on a single command line?
    & and | (the pipe character)
  8. How can you continue a command onto the next line?
    type \ immediately before hitting Enter
  9. What is special about a global variable?
    you can use it in any subshell of the shell in which it was created.
  10. What are the limitations of a local variable?
    you can only use it in the shell in which it was created