CSE271: Short Quiz #7 -- Shell Scripting and Regular Expressions

  1. Given a set of strings that end in .html or .htm, what would
    • (2 points) the pattern to match just those ending in .htm as filenames using globbing
    • (2 points) the regular expression to match those ending in .htm (as strings, one per line)

  2. (2 points) When a user types an argument with wildcards to a program (such as more a*.txt), where does the expansion take place -- in the program or the shell?

  3. (2 points) Write a snippet of bash shell script that tests whether the file /usr/local/lib/sysbashrc exists, and if so, echo Yes.

  4. (2 points) What will the following bash script snippet generate as output, if you were to run it?
      cat << FINISH
      Hello $LOGNAME
      FINISH
      echo Goodbye $LOGNAME
      


Last revised: 15 March 2007, Brian D. Davison.