home *** CD-ROM | disk | FTP | other *** search
- #----------------------------------------------------------------------#
- # File: functions
- # Auth: Christoph. Alex. North-Keys Sun Apr 28 23:22:27 EDT 1991
- # Desc: basic functions for the bash version of the elven scripts
- #----------------------------------------------------------------------#
- message functions' '
-
- lsf () { echo `declare -f | tr -d '\012\015'` | sed 's@}declare[ ]@}\
- declare @g' | sed 's@^declare -f@+ @g' }
-
- c () { if [ $# -ge 1 ]; then cd "$*"; else cd; fi ; . ; }
- . () { dirs ; }
- .. () { cd .. ; . ; }
- / () { clear ; . ; }
- j () { jobs -l ; }
- h () { history | p ; }
- p () { $PAGER $* ; }
- ]d () { pushd $* ; . ; }
- [d () { popd $* ; . ; }
- f () { fg %$* ; }
-
- rm ()
- {
- ls -FCsd $*
- local reply ; echon 'remove[ny]? ' ; read reply
- if [ "$reply" = "y" ] ; then /bin/rm -rf $* ; else echo '(cancelled)' ; fi
- }
-
- if type -path y 2>&1 >/dev/null; then :; else
- y () { $EDITOR $* ; }
- fi
-
- if type -path li 2>&1 >/dev/null; then :; else
- l () { ls -FCa $* ; }
- if [ `ls -ldg | wc -w` -gt `ls -ld | wc -w` ]; then
- # BSD
- li () { ls -Flgas $* ; }
- lf () { ls -Flgsd $* ; }
- lr () { ls -Flgasrt $* ; }
- else
- # USG
- li () { ls -Flas $* ; }
- lf () { ls -Flsd $* ; }
- lr () { ls -Flasrt $* ; }
- fi
- fi
-
- divine ()
- {
- local bcast="$ELVEN/broadcast"
- if [ $# -eq 0 ]; then
- echo 'self' > $bcast
- else
- case $1 in
- -) cat > $bcast ;;
- -c) shift ; echo "$*" > $bcast ;;
- -f) shift ; cat $1 > $bcast ;;
- *) local prog=divine
- echo "$prog"' -- send a directive to all running bash progs'
- echo 'syntax: '"$prog"' [ - | -c <cmd> | -f <file> ]'
- echo '- use stdin'
- echo '-c run <cmd>'
- echo '-f run copy of <file>'
- echo 'with no args, as if "'"$prog"' -c self" was used'
- return
- esac
- fi
- 2>/dev/null kill -USR1 $(ps -x | awk '($5 == "bash")||($5 == "-bash") { print $1 }')
- }
-
- self functions.loc
- #-------------------------------------------eof
-