aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Fabian Homborg <FHomborg@gmail.com>2015-10-21 12:38:45 +0200
committerGravatar Fabian Homborg <FHomborg@gmail.com>2015-10-21 12:38:45 +0200
commit3e7dfd7f5e188e1e106cfb78604e84ee54051217 (patch)
tree09de3d8c0674e94c40f9866ccab90406763f3b55
parentf21d826850fcca89c5bb8addc7597db221f85f2d (diff)
Switch useradd and chsh to `string`
-rw-r--r--share/completions/chsh.fish4
-rw-r--r--share/completions/useradd.fish4
2 files changed, 4 insertions, 4 deletions
diff --git a/share/completions/chsh.fish b/share/completions/chsh.fish
index 232513ec..31afe400 100644
--- a/share/completions/chsh.fish
+++ b/share/completions/chsh.fish
@@ -3,8 +3,8 @@
#
# This grep tries to match nonempty lines that do not start with hash
-complete -c chsh -s s -l shell -x -a "( __fish_sgrep '^[^#]' /etc/shells)" -d "Specify your login shell"
-complete -c chsh -s u -l help -d "Display help and exit"
+complete -c chsh -s s -l shell -x -a "(string match -r '^[^#].*' < /etc/shells)" -d "Specify your login shell"
+complete -c chsh -s u -l help -d "Display help and exit "
complete -c chsh -s v -l version -d "Display version and exit"
complete -x -c chsh -a "(__fish_complete_users)"
diff --git a/share/completions/useradd.fish b/share/completions/useradd.fish
index 651c1c33..37c9a729 100644
--- a/share/completions/useradd.fish
+++ b/share/completions/useradd.fish
@@ -18,5 +18,5 @@ complete -c useradd -s u -l uid --description 'The numerical value of the user\'
complete -c useradd -s b -l base-dir --description 'The initial path prefix for a new user\'s home directory' -r -a '(__fish_complete_directories)'
complete -c useradd -s e -l expiredate --description 'The date on which the user account is disabled' -r
complete -c useradd -s f -l inactive --description 'The number of days after a password has expired before the account will be disabled' -r
-complete -c useradd -s g -l gid --description 'The group name or ID for a new user\'s initial group' -x -a '( __fish_sgrep "^[^#]" /etc/group|cut -d : -f 1,3|sed -e "s/:/\n/")'
-complete -c useradd -s s -l shell --description 'Name of the new user\'s login shell' -x -a '( __fish_sgrep "^[^#]" /etc/shells)'
+complete -c useradd -s g -l gid --description 'The group name or ID for a new user\'s initial group' -x -a '(string match -r "^[^#].*" < /etc/group | cut -d : -f 1,3 | string replace -a ":" \n)'
+complete -c useradd -s s -l shell --description 'Name of the new user\'s login shell' -x -a '(string match -r "^[^#].*" < /etc/shells)'