Appendix B. Sample Environment File

   

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

Table of Contents


This appendix contains a sample environment file. It sets the global functions, aliases, and prompt variable.

 #  #     Sample env File  #  # Function md - make a directory and _cd to it  function md {        mkdir $1 && _cd $1  }  # Set up the echo alias  alias -x echo='print -'  # Set temporary prompt variable to the command number  # followed by a colon  PS0='!:'  # Function _cd - changes directories, then sets the  # command prompt to: "command-number:pathname>"  function _cd {        if (($# == 0))        then              'cd'              PS1="$PS0$PWD> "        fi        if (($# == 1))        then              'cd' $1              PS1="$PS0$PWD> "        fi        if (($# == 2))        then              'cd' $1 $2              PS1="$PS0$PWD> "        fi  }  # Alias the cd command to the _cd function  alias -x cd=_cd  # Export the _cd and md functions  typeset -fx _cd md 

       
    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