[comp.sys.amiga] Shell tricks

ejkst@cisunx.UUCP (Eric J. Kennedy) (12/04/87)

# [  "                           "  --Claude Rains ]
#
# I know there are lots of Shell users out there.  I would be interested to see
# what kind of useful aliases/.sh files people have cooked up.  

# The following is my offering. This file can be SOURCEd, after removing 
# the header and footer.  You will also need to put the long lines back 
# together.  Print, cd, and pop are in two pieces; just join each line with 
# the line below it.

# Note the use of '%q foreach i ( $q )' to take advantage of Shell's filename
# expansion.  So you can type 'print *.c *.h' or 'lock :.../*' to delete 
# protect everything on a disk.

# print files.  Not the ideal print spooler, but ok for small files.
alias print "%q  i ( $q ) \"date >prt: ; echo $i >prt: ; echo >prt: ; 
	copy $i prt: ; echo ^l \>prt: \""

# locking and unlocking files.  (more than one at a time)
alias lock "%q foreach i ( $q ) \"protect $i rwe\""
alias unlock "%q foreach i ( $q ) \"protect $i rwed\""

# remove--overide delete protection.  
alias rmx "%w unlock $w ; rm $w"

# multi-colored current directory prompt  (my favorite)
alias cd "%i \\cd $i ; strhead dev : $_cwd; strtail path : $_cwd; 
	set _prompt ^[[32m$dev:^[[33m$path^[[32m \\> ^[[31m "

# push and pop directories
alias pop "strhead _cwd ~ $popdir ; strtail popdir ~ $popdir ; 
	cd >nil: $_cwd ;  pwd >nil: ; c >nil: ""
alias push "%q set popdir $_cwd~$popdir ; c $q"


# I use these on Shell V2.7m.  I've used most of them on earlier versions,
# but I don't know if I've modified them since, so I can't promise they'll
# work on earlier version.

# By the way, Thanks, Matt and Steve!!!  I would be lost without your Shell!


Eric Kennedy