Previous Section  < Day Day Up >  Next Section

LAB 38: REDIRECTION

  1. Go into the editor and create the following two-line text file called ex6:

    
    Last time I went to the beach I found a sea shell.
    
    While in Kansas I found a corn shell.
    
    

  2. Now append this line to your ex6 file:

    
    The National Enquirer says someone gave birth to a shell, called the born shell.
    
    

  3. Mail the ex6 file to yourself.

  4. Using a pipe, count the number of lines (wc –l) in your ex6 file.

  5. To list all set options, type the following:

    
    set –o
    
    

    Do you have the noclobber variable set? If not, type the following:

    
    set –o noclobber
    
    

    What happened?

  6. Type the following at the command line:

    
    cat << FINIS
    
    How are you $LOGNAME
    
    The time is `date`Bye!!
    
    FINIS
    
    

    What printed?

  7. Now try this using tabs:

    
    cat <<– END
    
       hello there
    
       how are you
    
    END
    
    

    What printed?

  8. Type the following at the command line:

    
    kat file 2> error || print kat failed
    
    

    What happened? Why?

  9. Now type the following at the command line:

    
    cat zombie 2> errorfile || print cat failed
    
    

    What happened? Why? How does the && operator work? Try your own command to test it.

  10. Use the find command to print all files that begin with an a from the root directory down. Put the standard output in a file called foundit and send the errors to /dev/null.

    Previous Section  < Day Day Up >  Next Section