Miscellaneous Commands

   

Korn Shell: Unix and Linux Programming Manual, Third Edition, The
By Anatole Olczak

Table of Contents
Appendix C.  C Shell Functionality


The following sections contain Korn shell equivalents of some miscellaneous C shell commands and functions.

The .logout File

In the C shell, commands in the ~/.logout file are executed on exit. If the following command is added to the ~/.profile file, then the same thing will happen in the Korn shell:

 trap '. ~/.logout' EXIT 

The chdir Command

The C shell chdir command changes to the specified directory and can be set to a Korn shell alias like this:

 alias chdir='cd' 

The logout Command

The C shell logout command is equivalent to the exit command. It can be set to a Korn shell alias:

 alias logout='exit 0' 

The setenv Command

The C shell setenv command is used to set/display variables and can be invoked like this:

setenv

display a list of variables

setenv variable

 

set variable to null

setenv variable value

 

set variable to value, then export it

It can be set to a Korn shell function like this:

 function setenv {        set  o allexport        typeset TMP="$1=$2"        eval $(print ${1+$TMP})        typeset  x $1  } 

The source Command

The C shell source reads and executes a file in the current environment. It can be aliased to the Korn shell . command:

 alias source=. 

       
    Top
     



    Korn Shell. Unix and Linux Programming Manual, Third Edition
    Korn Shell. Unix and Linux Programming Manual, Third Edition
    ISBN: N/A
    EAN: N/A
    Year: 2000
    Pages: 177

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