Shell Programming

The flashcards below were created by user randycapped on FreezingBlue Flashcards.

  1. What would the output from the following command be given the list of files given?
    Image Upload 1
    Command: echo *

    Give the meaning in English.
    • Image Upload 2
    • print all files

    The echo command prints  (or echoes)  at the terminal whatever else you happen to type on the line (with some exceptions)

    The asterisk * matches zero or more characters, meaning that x* matches the file x as well as x1, x2, xabc... and so on.
  2. What would the output  from the following command be given the list of files given?
    Image Upload 3
    Command: echo m[a-df-z]*

    Give the meaning in English.
    • Image Upload 4
    • Print to terminal by using echo anything that starts with the letter m followed by [any lower case letter except for e] followed by zero or more characters *
  3. What would the output from the following command be given the list of files given?
    Image Upload 5
    Command: echo jan*

    Give the meaning in English.
    • Image Upload 6
    • Print to terminal by using echo anything that starts with jan followed by zero or more characters *
  4. What would the output from the following command be given the list of files given?
    Image Upload 7
    Command: echo ?????

    Give the meaning in English.
    • Image Upload 8
    • Print to terminal by using echo anything that matches 5 characters ?????
  5. What would the output from the following command be given the list of files given?
    Image Upload 9
    Command: echo jan?? feb?? mar??

    Give the meaning in English.
    • Image Upload 10
    • Print to terminal by using echo anything that starts with jan feb or mar followed by two characters ??
  6. What would the output from the following command be given the list of files given?
    Image Upload 11
    Command: echo *[!0-9]

    Give the meaning in English.
    • Image Upload 12
    • Print to terminal by using echo anything that starts with any characters * that [are not ! followed by a numerical 0-9 character]
  7. What would the output from the following command be given the list of files given?
    Image Upload 13
    Command: echo [A-Z]*

    Give the meaning in English.
    The answer should be A-Z since there is nothing in the list that matches any uppercase character followed by any characters.

    •  However, the answer I got was:
    • Image Upload 14
    • It was still marked correct as this happens sometimes with different systems.
  8. What would the output from the following command be given the list of files given?
    Image Upload 15
    Command: echo *.*

    Give the meaning in English.
    • Image Upload 16
    • Print to terminal by using echo anything that starts with any character * followed by a dot . followed by any character *
  9. What would the output from the following command be given the list of files given?
    Image Upload 17
    Command: echo *02

    Give the meaning in English.
    • Image Upload 18
    • Print to terminal by using echo anything that starts with any character * and ends with 02.
  10. What would the output from the following command be given the list of files given?
    Image Upload 19
    Command: echo [fjm][ae][bnr]*

    Give the meaning in English.
    • Image Upload 20
    • Print to terminal by using echo anything that starts with a character f , j or m [fjm] followed by a character of a or e [ae] followed by a character of b, n or r [bnr] followed by any characters *
Author
ID
270165
Card Set
Shell Programming
Description
Simple commands for Unix
Updated
Show Answers