diff --git a/share/completions/apt-proxy-import.fish b/share/completions/apt-proxy-import.fish index 65855b7..8e09457 100644 --- a/share/completions/apt-proxy-import.fish +++ b/share/completions/apt-proxy-import.fish @@ -4,7 +4,7 @@ complete -f -c apt-proxy-import -s V -l version -d (N_ 'Display version and exit complete -f -c apt-proxy-import -s v -l verbose -d (N_ 'Verbose mode') complete -f -c apt-proxy-import -s q -l quiet -d (N_ 'No message to STDOUT') complete -f -c apt-proxy-import -s r -l recursive -d (N_ 'Recurse into subdir') -complete -r -c apt-proxy-import -s i -l import-dir -a '(ls -Fp|grep /\$)' -d (N_ 'Dir to import') +complete -r -c apt-proxy-import -s i -l import-dir -a '(ls -Fp|sgrep /\$)' -d (N_ 'Dir to import') complete -r -c apt-proxy-import -s u -l user -a '(__fish_complete_users)' -d (N_ 'Change to user') complete -r -c apt-proxy-import -s d -l debug -d (N_ 'Debug level[default 0]') diff --git a/share/completions/apt-show-source.fish b/share/completions/apt-show-source.fish index 9a3fffd..0ab5c32 100644 --- a/share/completions/apt-show-source.fish +++ b/share/completions/apt-show-source.fish @@ -2,8 +2,8 @@ complete -c apt-show-source -s h -l help -d (N_ 'Display help and exit') complete -r -c apt-show-source -l status-file -d (N_ 'Read package from file') -f complete -r -c apt-show-source -o stf -d (N_ 'Read package from file') -f -complete -r -c apt-show-source -l list-dir -a '(ls -Fp .|grep /\$) /var/lib/apt/lists' -d (N_ 'Specify APT list dir') -complete -r -c apt-show-source -o ld -a '(ls -Fp .|grep /\$) /var/lib/apt/lists' -d (N_ 'Specify APT list dir') +complete -r -c apt-show-source -l list-dir -a '(ls -Fp .|sgrep /\$) /var/lib/apt/lists' -d (N_ 'Specify APT list dir') +complete -r -c apt-show-source -o ld -a '(ls -Fp .|sgrep /\$) /var/lib/apt/lists' -d (N_ 'Specify APT list dir') complete -r -c apt-show-source -s p -l package -a '(apt-cache pkgnames)' -d (N_ 'List PKG info') complete -f -c apt-show-source -l version-only -d (N_ 'Display version and exit') complete -f -c apt-show-source -s a -l all -d (N_ 'Print all source packages with version') diff --git a/share/completions/apt-show-versions.fish b/share/completions/apt-show-versions.fish index 1f3ca69..4c68728 100644 --- a/share/completions/apt-show-versions.fish +++ b/share/completions/apt-show-versions.fish @@ -9,6 +9,6 @@ complete -f -c apt-show-versions -s v -l verbose -d (N_ 'Print verbose info') complete -f -c apt-show-versions -s i -l initialize -d (N_ 'Init or update cache only') complete -r -c apt-show-versions -l status-file -d (N_ 'Read package from file') complete -r -c apt-show-versions -o stf -d (N_ 'Read package from file') -complete -r -c apt-show-versions -l list-dir -a '(ls -Fp .|grep /\$) /var/lib/apt/lists /var/state/apt/lists' -d (N_ 'Specify APT list dir') -complete -r -c apt-show-versions -o ld -a '(ls -Fp .|grep /\$) /var/lib/apt/lists /var/state/apt/lists' -d (N_ 'Specify APT list dir') +complete -r -c apt-show-versions -l list-dir -a '(ls -Fp .|sgrep /\$) /var/lib/apt/lists /var/state/apt/lists' -d (N_ 'Specify APT list dir') +complete -r -c apt-show-versions -o ld -a '(ls -Fp .|sgrep /\$) /var/lib/apt/lists /var/state/apt/lists' -d (N_ 'Specify APT list dir') diff --git a/share/completions/chown.fish b/share/completions/chown.fish index 8dbead2..29c22ef 100644 --- a/share/completions/chown.fish +++ b/share/completions/chown.fish @@ -9,4 +9,4 @@ complete -c chown -s v -l verbose -d (N_ "Output diagnostic for every file") complete -c chown -s h -l help -d (N_ "Display help and exit") complete -c chown -l version -d (N_ "Display version and exit") complete -c chown -d (N_ "Username") -a "(__fish_print_users):" -complete -c chown -d (N_ "Username") -a "(echo (commandline -ct)|grep -o '.*:')(cat /etc/group |cut -d : -f 1)" +complete -c chown -d (N_ "Username") -a "(echo (commandline -ct)|sgrep -o '.*:')(cat /etc/group |cut -d : -f 1)" diff --git a/share/completions/fusermount.fish b/share/completions/fusermount.fish index 13d34c2..45ae892 100644 --- a/share/completions/fusermount.fish +++ b/share/completions/fusermount.fish @@ -5,8 +5,8 @@ # complete -c fusermount -d (N_ "Mount point") -x -a ' ( - cat /etc/mtab | grep "^sshfs" | cut -d " " -f 1-2|tr " " \n|sed -e "s/[0-9\.]*:\//\//"|grep "^/" - cat /etc/mtab | grep "^fuseiso" | cut -d " " -f 1-2|tr " " \n|sed -e "s/[0-9\.]*:\//\//"|grep "^/" + cat /etc/mtab | sgrep "^sshfs" | cut -d " " -f 1-2|tr " " \n|sed -e "s/[0-9\.]*:\//\//"|sgrep "^/" + cat /etc/mtab | sgrep "^fuseiso" | cut -d " " -f 1-2|tr " " \n|sed -e "s/[0-9\.]*:\//\//"|sgrep "^/" ) ' diff --git a/share/completions/gpg.fish b/share/completions/gpg.fish index 41d48e9..903fa44 100644 --- a/share/completions/gpg.fish +++ b/share/completions/gpg.fish @@ -37,7 +37,7 @@ function __fish_print_gpg_algo -d "Complete using all algorithms of the type spe # expire when the function goes out of scope, and the original locale # will take effect again. set -lx LC_ALL C - gpg --version | grep "$argv:"| grep -v "Home:"|cut -d : -f 2 |tr , \n|tr -d " " + gpg --version | sgrep "$argv:"| sgrep -v "Home:"|cut -d : -f 2 |tr , \n|tr -d " " end diff --git a/share/completions/kill.fish b/share/completions/kill.fish index 232f99e..94a8a77 100644 --- a/share/completions/kill.fish +++ b/share/completions/kill.fish @@ -7,7 +7,7 @@ if kill -L ^/dev/null >/dev/null complete -c kill -s L -d "List codes and names of available signals" - set -- signals (kill -L | sed -e 's/\([0-9][0-9]*\) *\([A-Z,0-9][A-Z,0-9]*\)/\1 \2\n/g;s/ +/ /g' | sed -e 's/^ //' | grep -E '^[^ ]+') + set -- signals (kill -L | sed -e 's/\([0-9][0-9]*\) *\([A-Z,0-9][A-Z,0-9]*\)/\1 \2\n/g;s/ +/ /g' | sed -e 's/^ //' | sgrep -E '^[^ ]+') for i in $signals set -- number (echo $i | cut -d " " -f 1) set -- name (echo $i | cut -d " " -f 2) @@ -24,7 +24,7 @@ else complete -c kill -s l -d "List codes and names of available signals" - for i in (kill -l|tr \ \t \n|grep '^[A-Z][A-Z0-9]*$') + for i in (kill -l|tr \ \t \n|sgrep '^[A-Z][A-Z0-9]*$') complete -c kill -o $i -d Send\ $i\ signal complete -c kill -o s -x -a $i\tSend\ $i\ signal -d "Send specified signal" end diff --git a/share/completions/make.fish b/share/completions/make.fish index 832524c..93da6b2 100644 --- a/share/completions/make.fish +++ b/share/completions/make.fish @@ -2,7 +2,7 @@ function __fish_print_make_targets set files Makefile makefile GNUmakefile - grep -h -E '^[^#%=$[:space:]][^#%=$]*:([^=]|$)' $files | cut -d ":" -f 1 | sed -e 's/^ *//;s/ *$//;s/ */\n/g' ^/dev/null + sgrep -h -E '^[^#%=$[:space:]][^#%=$]*:([^=]|$)' $files | cut -d ":" -f 1 | sed -e 's/^ *//;s/ *$//;s/ */\n/g' ^/dev/null end # This completion is a bit ugly. It reenables file completion on @@ -10,7 +10,7 @@ end # filename completion. Unfortunatly, this turns out to be a bit # complicated to do. -set -l is_assignment "commandline -ct|grep '..*='" +set -l is_assignment "commandline -ct|sgrep '..*='" set -l complete_file_assignment '(commandline -ct)(complete --do-complete=this_command_does_not_exist\ (commandline -ct|sed -e \'s/.*=//\'))' complete -c make --condition $is_assignment -a $complete_file_assignment diff --git a/share/completions/mount.fish b/share/completions/mount.fish index 35a9996..0296063 100644 --- a/share/completions/mount.fish +++ b/share/completions/mount.fish @@ -4,7 +4,7 @@ # including mount and df # Completions for mount -complete -x -c mount -a '(cat /etc/fstab|sed -e "s/^\([^ \t]*\)[ \t]*\([^ \t]*\).*/\1\n\2/"|grep "^/")' -d (N_ 'Mount point') +complete -x -c mount -a '(cat /etc/fstab|sed -e "s/^\([^ \t]*\)[ \t]*\([^ \t]*\).*/\1\n\2/"|sgrep "^/")' -d (N_ 'Mount point') complete -c mount -s V -d (N_ 'Display version and exit') complete -c mount -s h -d (N_ 'Display help and exit') complete -c mount -s v -d (N_ 'Verbose mode') diff --git a/share/completions/mplayer.fish b/share/completions/mplayer.fish index c2fbf25..e6588ed 100644 --- a/share/completions/mplayer.fish +++ b/share/completions/mplayer.fish @@ -57,25 +57,25 @@ complete -c mplayer -o utf8 -d (N_ "Handle subtitlefile as utf8") complete -c mplayer -o vo -x -d (N_ "Video output") -a " ( - mplayer -vo help|grep \t.\*\t'\|^ *[a-zA-Z0-9][a-zA-Z0-9]* '|sed -e 's/[\t ]*\([a-zA-Z0-9]*\)[\t ]*\(.*\)/\1'\t'\2/' + mplayer -vo help|sgrep \t.\*\t'\|^ *[a-zA-Z0-9][a-zA-Z0-9]* '|sed -e 's/[\t ]*\([a-zA-Z0-9]*\)[\t ]*\(.*\)/\1'\t'\2/' ) " complete -c mplayer -o ao -x -d (N_ "Audio output") -a " ( - mplayer -ao help|grep \t.\*\t'\|^ *[a-zA-Z0-9][a-zA-Z0-9]* '|sed -e 's/[\t ]*\([a-zA-Z0-9]*\)[\t ]*\(.*\)/\1'\t'\2/' + mplayer -ao help|sgrep \t.\*\t'\|^ *[a-zA-Z0-9][a-zA-Z0-9]* '|sed -e 's/[\t ]*\([a-zA-Z0-9]*\)[\t ]*\(.*\)/\1'\t'\2/' ) " complete -c mplayer -o afm -x -d (N_ "Audio output") -a " ( - __fish_append ',' (mplayer -afm help|grep \t.\*\t'\|^ *[a-zA-Z0-9][a-zA-Z0-9]* '|sed -e 's/[\t ]*\([a-zA-Z0-9]*\)[\t ]*\(.*\)/\1'\t'\2/') + __fish_append ',' (mplayer -afm help|sgrep \t.\*\t'\|^ *[a-zA-Z0-9][a-zA-Z0-9]* '|sed -e 's/[\t ]*\([a-zA-Z0-9]*\)[\t ]*\(.*\)/\1'\t'\2/') ) " complete -c mplayer -o vfm -x -d (N_ "Video output") -a " ( - __fish_append ',' (mplayer -vfm help|grep \t.\*\t'\|^ *[a-zA-Z0-9][a-zA-Z0-9]* '|sed -e 's/[\t ]*\([a-zA-Z0-9]*\)[\t ]*\(.*\)/\1'\t'\2/') + __fish_append ',' (mplayer -vfm help|sgrep \t.\*\t'\|^ *[a-zA-Z0-9][a-zA-Z0-9]* '|sed -e 's/[\t ]*\([a-zA-Z0-9]*\)[\t ]*\(.*\)/\1'\t'\2/') ) " diff --git a/share/completions/screen.fish b/share/completions/screen.fish index 32c28a0..bd0525d 100644 --- a/share/completions/screen.fish +++ b/share/completions/screen.fish @@ -1,5 +1,5 @@ function __fish_complete_screen -d (N_ "Print a list of running screen sessions") - screen -list |grep \^\t.\*\(.\*\)|sed -e 's/\t\(.*\)\t(\(.*\))/\1'\t'Screen: \2/' + screen -list |sgrep \^\t.\*\(.\*\)|sed -e 's/\t\(.*\)\t(\(.*\))/\1'\t'Screen: \2/' end complete -c screen -x diff --git a/share/completions/ssh.fish b/share/completions/ssh.fish index 711e0cb..57250e9 100644 --- a/share/completions/ssh.fish +++ b/share/completions/ssh.fish @@ -20,7 +20,7 @@ complete -c ssh -s a -d (N_ "Disables forwarding of the authentication agent") complete -c ssh -s A -d (N_ "Enables forwarding of the authentication agent") complete -x -c ssh -s b -d (N_ "Interface to transmit from") -a " ( - cat /proc/net/arp ^/dev/null| grep -v '^IP'|cut -d ' ' -f 1 ^/dev/null + cat /proc/net/arp ^/dev/null| sgrep -v '^IP'|cut -d ' ' -f 1 ^/dev/null ) " diff --git a/share/completions/umount.fish b/share/completions/umount.fish index 03205f5..339bef1 100644 --- a/share/completions/umount.fish +++ b/share/completions/umount.fish @@ -5,7 +5,7 @@ # # Find all mountpoints # -complete -c umount -d (N_ "Mount point") -x -a '(cat /etc/mtab | cut -d " " -f 1-2|tr " " \n|sed -e "s/[0-9\.]*:\//\//"|grep "^/")' +complete -c umount -d (N_ "Mount point") -x -a '(cat /etc/mtab | cut -d " " -f 1-2|tr " " \n|sed -e "s/[0-9\.]*:\//\//"|sgrep "^/")' complete -c umount -s V -d (N_ "Display version and exit") complete -c umount -s h -d (N_ "Display help and exit") diff --git a/share/completions/valgrind.fish b/share/completions/valgrind.fish index a94b05e..6e7b575 100644 --- a/share/completions/valgrind.fish +++ b/share/completions/valgrind.fish @@ -1,5 +1,5 @@ -if valgrind --version | grep -- '-2\.[012]\.' >/dev/null ^/dev/null +if valgrind --version | sgrep -- '-2\.[012]\.' >/dev/null ^/dev/null # In older versions of Valgrind, the skin selection option was # '--skin' set -g skin skin diff --git a/share/config.fish.in b/share/config.fish.in index 0857c42..e0ec5c3 100644 --- a/share/config.fish.in +++ b/share/config.fish.in @@ -76,7 +76,7 @@ end set -l tmp (printf "%s" \^$PATH'/?$|') set -l path_regexp \((echo $tmp | sed -e "s/.\$//")\) -for i in (printf "%s\n" $path_list|grep -E -v $path_regexp) +for i in (printf "%s\n" $path_list|sgrep -E -v $path_regexp) if test -d $i set PATH $PATH $i end diff --git a/share/config_interactive.fish.in b/share/config_interactive.fish.in index 83fee3c..74da5b8 100644 --- a/share/config_interactive.fish.in +++ b/share/config_interactive.fish.in @@ -197,7 +197,7 @@ function __fish_print_interfaces -d "Print a list of known network interfaces" end function __fish_print_addresses -d "Print a list of known network addresses" - /sbin/ifconfig |grep 'inet addr'|cut -d : -f 2|cut -d ' ' -f 1 + /sbin/ifconfig |sgrep 'inet addr'|cut -d : -f 2|cut -d ' ' -f 1 end function __fish_print_users -d "Print a list of local users" @@ -208,7 +208,7 @@ end # Completions for the shell and it's builtin commands and functions # -for i in (builtin -n|grep -E -v '(while|for|if|function|switch)' ) +for i in (builtin -n|sgrep -E -v '(while|for|if|function|switch)' ) complete -c $i -s h -l help -d "Display help and exit" end diff --git a/share/functions/__fish_complete_cd.fish b/share/functions/__fish_complete_cd.fish index f498f2a..a43bac6 100644 --- a/share/functions/__fish_complete_cd.fish +++ b/share/functions/__fish_complete_cd.fish @@ -18,7 +18,7 @@ function __fish_complete_cd -d "Completions for the cd command" end - if echo (commandline -ct)|grep '^/\|^\./\|^\.\./' >/dev/null + if echo (commandline -ct)|sgrep '^/\|^\./\|^\.\./' >/dev/null # This is an absolute search path eval printf '\%s\\tDirectory\\n' (commandline -ct)\*/ else diff --git a/share/functions/__fish_complete_man.fish b/share/functions/__fish_complete_man.fish index 7eb69f0..dad6ed0 100644 --- a/share/functions/__fish_complete_man.fish +++ b/share/functions/__fish_complete_man.fish @@ -21,7 +21,7 @@ function __fish_complete_man set section $section"[^)]*" # Do the actual search - apropos (commandline -ct) | grep \^(commandline -ct) | sed -n -e 's/\([^ ]*\).*(\('$section'\)) *- */\1'\t'\2: /p' + apropos (commandline -ct) | sgrep \^(commandline -ct) | sed -n -e 's/\([^ ]*\).*(\('$section'\)) *- */\1'\t'\2: /p' end end diff --git a/share/functions/__fish_contains_opt.fish b/share/functions/__fish_contains_opt.fish index 5b06007..ec7eb67 100644 --- a/share/functions/__fish_contains_opt.fish +++ b/share/functions/__fish_contains_opt.fish @@ -29,11 +29,11 @@ function __fish_contains_opt -d "Checks if a specific option has been given in t continue end - if commandline -cpo | grep -- "^-"$i"\|^-[^-]*"$i >/dev/null + if commandline -cpo | sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null return 0 end - if commandline -ct | grep -- "^-"$i"\|^-[^-]*"$i >/dev/null + if commandline -ct | sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null return 0 end end diff --git a/share/functions/__fish_print_hostnames.fish b/share/functions/__fish_print_hostnames.fish index f6de978..69e41e0 100644 --- a/share/functions/__fish_print_hostnames.fish +++ b/share/functions/__fish_print_hostnames.fish @@ -3,11 +3,11 @@ function __fish_print_hostnames -d "Print a list of known hostnames" # Print all hosts from /etc/hosts if test -f /etc/hosts - sed /dev/null - emerge -s \^(commandline -tc) |grep "^*" |cut -d\ -f3 |cut -d/ -f2 + emerge -s \^(commandline -tc) |sgrep "^*" |cut -d\ -f3 |cut -d/ -f2 return end diff --git a/share/functions/contains.fish b/share/functions/contains.fish index 72edc9e..10dee39 100644 --- a/share/functions/contains.fish +++ b/share/functions/contains.fish @@ -32,14 +32,11 @@ function contains -d (N_ "Test if a key is contained in a set of values") set -- key $argv[1] set -e argv[1] - # Don't use any grep options! - set -l GREP_OPTIONS - # # Loop through values # - printf "%s\n" $argv|grep -Fx -- $key >/dev/null + printf "%s\n" $argv|sgrep -Fx -- $key >/dev/null return $status end diff --git a/share/functions/sgrep.fish b/share/functions/sgrep.fish new file mode 100644 index 0000000..c351578 --- /dev/null +++ b/share/functions/sgrep.fish @@ -0,0 +1,5 @@ + +function sgrep -d "Call grep without honoring GREP_OPTIONS settings" + set -l GREP_OPTIONS + grep $argv +end \ No newline at end of file diff --git a/share/functions/trap.fish b/share/functions/trap.fish index 27af0f4..5cd91e2 100644 --- a/share/functions/trap.fish +++ b/share/functions/trap.fish @@ -113,7 +113,7 @@ function trap -d 'Perform an action when the shell recives a signal' if count $opt >/dev/null set -- names $opt else - set -- names (functions -na|grep "^__trap_handler_"|sed -e 's/__trap_handler_//' ) + set -- names (functions -na|sgrep "^__trap_handler_"|sed -e 's/__trap_handler_//' ) end for i in $names diff --git a/share/functions/umask.fish b/share/functions/umask.fish index 78ab008..45f192f 100644 --- a/share/functions/umask.fish +++ b/share/functions/umask.fish @@ -1,12 +1,12 @@ function __fish_umask_parse -d "Internal umask function" # Test if already a valid octal mask, and pad it with zeros - if echo $argv | grep -E '^(0|)[0-7]{1,3}$' >/dev/null + if echo $argv | sgrep -E '^(0|)[0-7]{1,3}$' >/dev/null for i in (seq (echo 5-(echo $argv|wc -c)|bc)); set argv 0$argv; end echo $argv else # Test if argument really is a valid symbolic mask - if not echo $argv | grep -E '^(((u|g|o|a|)(=|\+|-)|)(r|w|x)*)(,(((u|g|o|a|)(=|\+|-)|)(r|w|x)*))*$' >/dev/null + if not echo $argv | sgrep -E '^(((u|g|o|a|)(=|\+|-)|)(r|w|x)*)(,(((u|g|o|a|)(=|\+|-)|)(r|w|x)*))*$' >/dev/null printf (_ "%s: Invalid mask '%s'\n") umask $argv >&2 return 1 end @@ -70,19 +70,19 @@ function __fish_umask_parse -d "Internal umask function" set mode set end - if not echo $perm|grep -E '^(r|w|x)*$' >/dev/null + if not echo $perm|sgrep -E '^(r|w|x)*$' >/dev/null printf (_ "%s: Invalid mask '%s'\n") umask $argv >&2 return end set val 0 - if echo $i |grep 'r' >/dev/null + if echo $i |sgrep 'r' >/dev/null set val 4 end - if echo $i |grep 'w' >/dev/null + if echo $i |sgrep 'w' >/dev/null set val (echo $val + 2|bc) end - if echo $i |grep 'x' >/dev/null + if echo $i |sgrep 'x' >/dev/null set val (echo $val + 1|bc) end