Appendix B. Sample Environment File

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
			

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.9.169