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 itfunction md {mkdir $1 && _cd $1}# Set up the echo aliasalias -x echo='print -'# Set temporary prompt variable to the command number# followed by a colonPS0='!:'# Function _cd - changes directories, then sets the# command prompt to: "command-number:pathname>"function _cd {if (($# == 0))then'cd'PS1="$PS0$PWD> "fiif (($# == 1))then'cd' $1PS1="$PS0$PWD> "fiif (($# == 2))then'cd' $1 $2PS1="$PS0$PWD> "fi}# Alias the cd command to the _cd functionalias -x cd=_cd# Export the _cd and md functionstypeset -fx _cd md