Previous Section  < Day Day Up >  Next Section

LAB 33: KORN SHELL—GETTING STARTED

  1. What shell are you using? How do you know?

  2. Do you have a .profile and/or a .kshrc file in your home directory? What is the difference between the .profile and .kshrc? What is the ENV file and how can you invoke it if you make changes in it?

  3. What is the default primary prompt? What is the default secondary prompt? Change your primary prompt at the command line so that it contains your login name.

  4. What is the purpose of setting each of the following variables?

    1. set –o ignoreeof

    2. set –o noclobber

    3. set –o trackall

    4. set –o monitor

    5. set –o vi

    Why are these variables set in the ENV file? What is the purpose of the PATH? What are the elements of your PATH variable?

  5. What is the difference between a local and an environment variable? How do you list all your variables? How do you list only environment variables? To list all your current option settings, type the following:

    
    set –o
    
    

    Which set options are turned on?

  6. Create a local variable called myname that contains your full name. Now export the variable. Type the following at the prompt:

    
    ksh
    
    

    Was the variable name exported? Type exit to get back to the parent shell. Make the variable name readonly. What is a readonly variable?

  7. What are positional parameters normally used for?

    1. Type the following:

      
      set apples pears peaches plums
      
      

      Using the positional parameters, print plums. Print apples peaches. Print apples pears peaches plums. Print the number of parameters. Reset the positional parameters to a list of veggies. Print the whole list of veggies. What happened to the fruit list?

    2. Type the following:

      
      set ––
      
      print $*
      
      

      What happened?

  8. Print the PID of the current shell. Type the following at the prompt:

    
    grep $LOGNAME /etc/passwd
    
    echo $?
    
    

    What does the $? tell you. What does the exit status tell you about the execution of a command?

  9. Change both the primary and secondary prompt in your .profile. How do you re-execute the .profile file without logging out and logging back in?

    Previous Section  < Day Day Up >  Next Section