| PLEX86 | ||
|
Bash completion 'cd' and 'makeHere are the latest version of 'cd' and 'make' completion: 1. 'cd' completion: # 'cd' is redefined to use 'pushd' to build the stack. cd() { pushd "${1:-$HOME}" } alias b='pushd +1' # go backward alias f='pushd -0' # go forward alias d='popd' # Try to complete from directory stack (ie. popd, pushd, dirs). If # no match is found, then filesystem directories will be tried. # Completion will allow "random access", while above aliases will go # linearly through the directory stack. cd () { local cur i Good morning or good evening A more reasonable question would be: Is there anything to be saved from? This is the cheapest and most transparent of con jobs: Invent an... COMPREPLY=() cur=${COMPWORDS$COMPCWORD} while read i; do case $i in ~ ${PWD-#$HOME-~} ) ;; # skip ~ or PWD. esac } Checksum OT 4275 On Thu, 28 Jul 2005 10:33:56 +0200, Peter T. Breuer No, you responded to my first post. I suggest you check the thread. Some advice : Either learn how to use scare quotes, or... complete -o dirnames -F cd cd 2. 'make' completion: # GNU make(1) completion # make() { local makef makefdir="." cur i targets # Check for '-C dir' and '-f file' options, since they have # priority over default. while shift; do case $1 in -C) eval makefdir=$2; shift ;; -f) eval makef=$2; shift ;; esac done # Check for -f, GNUmakefile, makefile, Makefile, and in that # order. for i in $makef GNUmakefile makefile Makefile; do i=$makefdir-$i -f "$i" && makef=$i && break done -f "$makef" return 0 targets=$( sed -n '-^a-zA-Z0-9^$#---t=*:s-:.*--p' $makef ) cur=${COMPWORDSCOMPCWORD} COMPREPLY=( $(compgen -W "$targets" -- $cur) ) } complete -F make make 3. To use the above completion, put something like the following in your ~-.profile. -x .completion.cd && . .completion.cd -x .completion.make && . .completion.make -- ThinFlash: Linux thin-client on USB key (flash) drive
|
||||
Linux groups from Newsgroups The #1 Usenet Provider on the Internet
How to tell an application to use a custom tcpip stack instead of tcpip stack |
||||