LAB 34: HISTORY

 <  Day Day Up  >  

  1. What is your HISTSIZE variable set to? What is your HISTFILE variable set to? Check your . kshrc file to see if set “o vi is there. If it has not been set, set it in the .kshrc file and re-execute the file by typing the following:

     . .kshrc 

  2. Type the following commands at the command line:

     ls date who cal 2 1993 date +%T 

    Type history or fc “l . What do these commands do? Print your history list in reverse. Print your history list without numbers . Print the current command and the five preceding it. Print everything from the tenth command to the present. Print everything between the most recent ls command to the most recent cal command.

  3. Using the r command, re-execute the last command. Re-execute the last command that started with the letter d . Change the cal command year output to 1897 . Change the date command +%T argument to find the current hour .

  4. If your history is set, press the Esc key at the command line and use the K key to move up through the history list. Change the ls command to ls “alF and re-execute it.

  5. Check to see if the FCEDIT variable has been set by typing the env command. If it has not been set, type the following at the command line:

     export FCEDIT=vi 

    Now type the following at the command line:

     fc 1 4 

    What happened ?

  6. How do you comment a line from your history list, so that it will be placed on the list without being executed?

  7. At the command line, type the following:

     touch a1 a2 a3 apples bears balloons a4 a45 

    Now using the history Esc sequences, do the following:

    1. Print the first file beginning with a .

    2. Print a list of all files beginning with a .

    3. Print the first file beginning with b .

    4. Print a command and comment it.

  8. At the command line, type the following:

     print a b c d e 

    Using the history Esc underscore command, change the command to the following:

     print e 

    Using the history Esc underscore command, change the first command to output:

     print c 

 <  Day Day Up  >  


UNIX Shells by Example
UNIX Shells by Example (4th Edition)
ISBN: 013147572X
EAN: 2147483647
Year: 2004
Pages: 454
Authors: Ellie Quigley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net