From a927efa0155c42549b85ddcf7cb6dd950debc20d Mon Sep 17 00:00:00 2001 From: Wilke Schwiedop Date: Wed, 21 Dec 2016 01:14:48 +0100 Subject: [PATCH] remove "cat file |" from scripts --- share/completions/adduser.fish | 2 +- share/completions/setxkbmap.fish | 12 ++++++------ share/completions/ssh.fish | 2 +- share/completions/umount.fish | 2 +- share/completions/useradd.fish | 2 +- .../functions/__fish_print_function_prototypes.fish | 2 +- share/functions/__fish_print_packages.fish | 2 +- share/functions/__fish_print_xdg_mimetypes.fish | 4 +--- 8 files changed, 13 insertions(+), 15 deletions(-) diff --git a/share/completions/adduser.fish b/share/completions/adduser.fish index 33d28182a..e55ff1c7d 100644 --- a/share/completions/adduser.fish +++ b/share/completions/adduser.fish @@ -16,7 +16,7 @@ complete -c adduser -l group --description 'When combined with --system, a group complete -c adduser -l help --description 'Display brief instructions' complete -c adduser -l home --description 'Use specified directory as the user\'s home directory' -x -a '(__fish_complete_directories)' complete -c adduser -l shell --description 'Use shell as the user\'s login shell, rather than the default specified by the configuration file' -x -a '(cat /etc/shells)' -complete -c adduser -l ingroup --description 'Add the new user to GROUP instead of a usergroup or the default group defined by USERS_GID in the configuration file' -x -a '(cat /etc/group|cut -d : -f 1)' +complete -c adduser -l ingroup --description 'Add the new user to GROUP instead of a usergroup or the default group defined by USERS_GID in the configuration file' -x -a '(cut -d : -f 1 /etc/group)' complete -c adduser -l no-create-home --description 'Do not create the home directory, even if it doesni\'t exist' complete -c adduser -l quiet --description 'Suppress informational messages, only show warnings and errors' complete -c adduser -l debug --description 'Be verbose, most useful if you want to nail down a problem with adduser' diff --git a/share/completions/setxkbmap.fish b/share/completions/setxkbmap.fish index 71aab63e8..6a557fb70 100644 --- a/share/completions/setxkbmap.fish +++ b/share/completions/setxkbmap.fish @@ -2,23 +2,23 @@ set -l filter '"s/\S+\s\S+\s(.+)\((.+)\)/\1\t\2/;"' complete -c setxkbmap -o '?' -o help -d 'Print this message' -complete -c setxkbmap -o compat -d 'Specifies compatibility map component name' -xa "(cat /usr/share/X11/xkb/compat.dir | sed -r $filter)" +complete -c setxkbmap -o compat -d 'Specifies compatibility map component name' -xa "(sed -r $filter /usr/share/X11/xkb/compat.dir)" complete -c setxkbmap -o config -d 'Specifies configuration file to use' -r complete -c setxkbmap -o device -d 'Specifies the device ID to use' -x complete -c setxkbmap -o display -d 'Specifies display to use' -x -complete -c setxkbmap -o geometry -d 'Specifies geometry component name' -xa "(cat /usr/share/X11/xkb/geometry.dir | sed -r $filter)" +complete -c setxkbmap -o geometry -d 'Specifies geometry component name' -xa "(sed -r $filter /usr/share/X11/xkb/geometry.dir)" complete -c setxkbmap -o I -d 'Add to list of directories to be used' -xa '(__fish_complete_directories)' -complete -c setxkbmap -o keycodes -d 'Specifies keycodes component name' -xa "(cat /usr/share/X11/xkb/keycodes.dir | sed -r $filter)" -complete -c setxkbmap -o keymap -d 'Specifies name of keymap to load' -xa "(cat /usr/share/X11/xkb/keymap.dir | sed -r $filter)" +complete -c setxkbmap -o keycodes -d 'Specifies keycodes component name' -xa "(sed -r $filter /usr/share/X11/xkb/keycodes.dir)" +complete -c setxkbmap -o keymap -d 'Specifies name of keymap to load' -xa "(sed -r $filter /usr/share/X11/xkb/keymap.dir)" complete -c setxkbmap -o layout -d 'Specifies layout used to choose component names' -xa "(__fish_complete_setxkbmap layout)" complete -c setxkbmap -o model -d 'Specifies model used to choose component names' -xa "(__fish_complete_setxkbmap model)" complete -c setxkbmap -o option -d 'Adds an option used to choose component names' -xa "(__fish_complete_list , '__fish_complete_setxkbmap option')" complete -c setxkbmap -o print -d 'Print a complete xkb_keymap description and exit' complete -c setxkbmap -o query -d 'Print the current layout settings and exit' complete -c setxkbmap -o rules -d 'Name of rules file to use' -x -complete -c setxkbmap -o symbols -d 'Specifies symbols component name' -xa "(cat /usr/share/X11/xkb/symbols.dir | sed -r $filter)" +complete -c setxkbmap -o symbols -d 'Specifies symbols component name' -xa "(sed -r $filter /usr/share/X11/xkb/symbols.dir)" complete -c setxkbmap -o synch -d 'Synchronize request w/X server' -complete -c setxkbmap -o types -d 'Specifies types component name' -xa "(cat /usr/share/X11/xkb/types.dir | sed -r $filter)" +complete -c setxkbmap -o types -d 'Specifies types component name' -xa "(sed -r $filter /usr/share/X11/xkb/types.dir)" complete -c setxkbmap -o v -o verbose -d 'Sets verbosity (1..10). Higher values yield more messages' -xa '(seq 1 10)' complete -c setxkbmap -o variant -d 'Specifies layout variant used to choose component names' -xa "(__fish_complete_setxkbmap variant)" diff --git a/share/completions/ssh.fish b/share/completions/ssh.fish index a8896b627..2d9c40b74 100644 --- a/share/completions/ssh.fish +++ b/share/completions/ssh.fish @@ -23,7 +23,7 @@ complete -c ssh -s a --description "Disables forwarding of the authentication ag complete -c ssh -s A --description "Enables forwarding of the authentication agent" complete -x -c ssh -s b --description "Interface to transmit from" -a " ( - cat /proc/net/arp ^/dev/null| string match -r -v '^IP'|cut -d ' ' -f 1 ^/dev/null + tail -n +2 /proc/net/arp | cut -d ' ' -f 1 ^/dev/null ) " diff --git a/share/completions/umount.fish b/share/completions/umount.fish index 85929fb82..7b164a071 100644 --- a/share/completions/umount.fish +++ b/share/completions/umount.fish @@ -16,7 +16,7 @@ complete -c umount -s d --description "In case the unmounted device was a loop d complete -c umount -s i --description "Don't call the /sbin/umount. helper even if it exists" complete -c umount -s a --description "Unmount all of the file systems described in /etc/mtab" complete -c umount -s t --description "Actions should only be taken on file systems of the specified type" -xa "(__fish_print_filesystems)" -complete -c umount -s O --description "Actions should only be taken on file systems with the specified options in /etc/fstab" -xa '(cat /etc/mtab | cut -d " " -f 4)\t"Mount option"' +complete -c umount -s O --description "Actions should only be taken on file systems with the specified options in /etc/fstab" -xa '(cut -d " " -f 4 /etc/mtab)\t"Mount option"' complete -c umount -s f --description "Force unmount (in case of an unreachable NFS system)" complete -c umount -s l --description "Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy" diff --git a/share/completions/useradd.fish b/share/completions/useradd.fish index 37c9a7290..0719d6196 100644 --- a/share/completions/useradd.fish +++ b/share/completions/useradd.fish @@ -7,7 +7,7 @@ complete -c useradd -s c -l comment --description 'A comment about this user' -r complete -c useradd -s d -l home --description 'Home directory for the new user' -x -a '(__fish_complete_directories)' -complete -c useradd -s G -l groups --description 'Supplementary groups' -xa '(__fish_append , (cat /etc/group|cut -d : -f 1))' +complete -c useradd -s G -l groups --description 'Supplementary groups' -xa '(__fish_append , (cut -d : -f 1 /etc/group))' complete -c useradd -s h -l help --description 'Display help message and exit' complete -c useradd -s m -l create-home --description 'The user\'s home directory will be created if it does not exist' complete -c useradd -s n --description 'A group having the same name as the user being added to the system will be created by default (when -g is not specified)' diff --git a/share/functions/__fish_print_function_prototypes.fish b/share/functions/__fish_print_function_prototypes.fish index 862b8dcc9..a29ab5b10 100644 --- a/share/functions/__fish_print_function_prototypes.fish +++ b/share/functions/__fish_print_function_prototypes.fish @@ -1,5 +1,5 @@ function __fish_print_function_prototypes -d "Prints the names of all function prototypes found in the headers in the current directory" - cat *.h* | sed -n "s/^\(.*[^[a-zA-Z_0-9]\|\)\([a-zA-Z_][a-zA-Z_0-9]*\) *(.*);.*\$/\2/p" + sed -n "s/^\(.*[^[a-zA-Z_0-9]\|\)\([a-zA-Z_][a-zA-Z_0-9]*\) *(.*);.*\$/\2/p" *.h* end diff --git a/share/functions/__fish_print_packages.fish b/share/functions/__fish_print_packages.fish index 1dc0893c4..c3985cd13 100644 --- a/share/functions/__fish_print_packages.fish +++ b/share/functions/__fish_print_packages.fish @@ -56,7 +56,7 @@ function __fish_print_packages if type -q -f zypper # Use libzypp cache file if available if test -f /var/cache/zypp/solv/@System/solv.idx - cat /var/cache/zypp/solv/*/solv.idx | awk '!/application:|srcpackage:|product:|pattern:|patch:/ {print $1'\t$package'}' + awk '!/application:|srcpackage:|product:|pattern:|patch:/ {print $1'\t$package'}' /var/cache/zypp/solv/*/solv.idx return end diff --git a/share/functions/__fish_print_xdg_mimetypes.fish b/share/functions/__fish_print_xdg_mimetypes.fish index 39f9a2798..dd1e28c13 100644 --- a/share/functions/__fish_print_xdg_mimetypes.fish +++ b/share/functions/__fish_print_xdg_mimetypes.fish @@ -1,5 +1,3 @@ function __fish_print_xdg_mimetypes --description 'Print XDG mime types' - cat ~/.local/share/applications/mimeinfo.cache | grep -v "\[MIME Cache\]" | tr = \t - cat /usr/share/applications/mimeinfo.cache | grep -v "\[MIME Cache\]" | tr = \t - + sed -e '/\[MIME Cache\]/d; y!=!\t!' ~/.local/share/applications/mimeinfo.cache /usr/share/applications/mimeinfo.cache end