lvc@cbscc.UUCP (Larry Cipriani) (10/05/84)
Would anyone have any ksh functions/aliases they'd like to post. Here's some I use all the time; fairly simple minded but very useful. These use Unix* 5.0 commands. alias -x ag='alias | fgrep' alias -x all='find . -print' alias -x l='ls -l' alias -x lp='/usr/bin/lp -dcent' alias -x lpstat='/usr/bin/lpstat -o | grep -v "^-0"' alias -x news='readnews -n cb.general scc.general \ scc.darn scc.generic net.sources' alias -x profile='. ~/.profile' alias -x reset='. ~/.aliases' alias -x smail='/usr/mail/PCS/bin/smail +edit' alias -x ti='/usr/bin/lp -dti' alias -x ul='print -n "User load:" ; who | wc -l' alias -x wg='who | grep' alias -x which='print "You are on cbscc"' alias -x xpr='/usr/lbin/xpr -!Ehjw120' # look for a string in the password file (this will need to be # modified for use on non-SCCS password files) function whois { for i in ${*} do grep ${i} /etc/passwd | \ sed -e s/.*:unix-// -e s/:$// -e s/5947[0-9].*://p done } # make a directory && change to it && pwd function mc { case ${#} in 1 ) mkdir ${1} && cd ${1} && pwd ;; * ) print - "usage: mc directory" ;; esac }
bamford@ihuxl.UUCP (bamford) (10/11/84)
Here is a function to set the prompt to the current directory. Very nice
if you tend to get lost easily.
----------------------------------------------------------------------
function fancy_cd
{
if [ $# -ne 0 ]
then
cd $*
else
cd
fi
PS1="${PWD} "
}
alias cd=fancy_cd
----------------------------------------------------------------------
The function MUST be defined before the alias.
Harold Bamford
AT&T Bell Labs
(cornet) 8-367-1866
Naperville, Ill
(312) 979-1866
--
Harold Bamford
AT&T Bell Labs
(cornet) 8-367-1866
Naperville, Ill
(312) 979-1866
marcus@pyuxt.UUCP (M. G. Hand) (10/12/84)
A very simple function which I find extremely useful for checking local shell scripts is this: function list { cat `whence $1`; } marcus hand (pyuxt!marcus)