IT 244: Introduction to Linux/Unix
Quiz 7 Answers

  1. If you wanted to run the executable file backup.sh in your current directory, but wanted the error messages to disappear, what would you write at the command line?
    ./backup.sh  2>  /dev/null
  2. What would you type at the command line, if you wanted to make the script cheer.sh executable?
    chmod  755 cheer.sh
  3. Write the hashbang line we use for scripts in this course.
    #! /bin/bash
  4. What command would you use to make the changes you made in the startup file for your login shell take effect?
    source .bash_profile
  5. What is special about a GLOBAL variable?
    you can use it in any subshell of the shell in which it was created.
  6. What are the limitations of a LOCAL variable?
    you can only use it in the shell in which it was created
  7. What would you write on the command line to set the value of the LOCAL variable named team to Red Sox.
    team="Red Sox"
  8. If you define a local variable, can a script see the value of this variable?
    no
  9. What would you write on the command line to create the GLOBAL variable named school and set its value to UMass Boston.
    export school="UMass Boston"
  10. Write the command you would use in a script to ask the user to provide a value for a variable named dir
    read -p "Directory: " dir