BASH SCRIPTING Flashcards
Consider the following script #!/bin/bash echo 'file redirection is easy' > file1 cat < file1 > file2 echo "as easy as pie" >> file2 cat file2 | sort What is the output from the last line of the script?
a. as easy as pie file redirection is easy
b. file redirection is easy
c. as easy as pie
d. file redirection is easy as easy as pie
a. as easy as pie file redirection is easy
What is the output from the following commands?
$ A=5
$ B=A+5
$ echo $B
a. 10
b. 5
c. A+5
d. 55
c. A+5
What is the output of the following commands?
$ DATA=’some stuff’
$ /bin/sh
$ echo $DATA
a. some
b. stuff
c. some stuff
d. A blank line
d. A blank line
Which of the following regular expressions would find Orville or Wilbur Wright on a line by itself?
a. $(Orville|Wilbur) Wright^
b. ^(Orville or Wilbur) Wright$
c. ^(Orville|Wilbur) Wright$
d. $[Orville|Wilbur] Wright$^
c. ^(Orville|Wilbur) Wright$
Which regular expression would match everything between double quotes in this example text? His nicknames are “Matt” and “Dawg”
a. “[^”]+”
b. “[A-Z]”
c. “.”
d. “*”
a. “[^”]+”