summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2013-07-30 18:46:23 +0200
committerDave Reisner <dreisner@archlinux.org>2013-07-30 19:04:46 +0200
commita72d698d0d9ff9c158155b44cdc77376df31a317 (patch)
tree3c80960a1404b44df57b200208664c206f96d8cf
parenttest-unit-file: return error without dumping core on permission error (diff)
downloadsystemd-a72d698d0d9ff9c158155b44cdc77376df31a317.tar.xz
systemd-a72d698d0d9ff9c158155b44cdc77376df31a317.zip
bash-completion: use a better definition of __contains_word
- scope the iterator var - use the correct, quoted, non-expansion prone positional parameter notation - prevent expansion on RHS of comparison - remove unneeded explicit returns. This really should be defined only once...
-rw-r--r--shell-completion/bash/hostnamectl7
-rw-r--r--shell-completion/bash/journalctl7
-rw-r--r--shell-completion/bash/localectl7
-rw-r--r--shell-completion/bash/loginctl7
-rw-r--r--shell-completion/bash/systemctl7
-rw-r--r--shell-completion/bash/systemd-analyze7
-rw-r--r--shell-completion/bash/systemd-coredumpctl7
-rw-r--r--shell-completion/bash/timedatectl7
-rw-r--r--shell-completion/bash/udevadm7
9 files changed, 36 insertions, 27 deletions
diff --git a/shell-completion/bash/hostnamectl b/shell-completion/bash/hostnamectl
index a57bffe15f..38ab1344f3 100644
--- a/shell-completion/bash/hostnamectl
+++ b/shell-completion/bash/hostnamectl
@@ -18,9 +18,10 @@
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
__contains_word () {
- local word=$1; shift
- for w in $*; do [[ $w = $word ]] && return 0; done
- return 1
+ local w word=$1; shift
+ for w in "$@"; do
+ [[ $w = "$word" ]] && return
+ done
}
_hostnamectl() {
diff --git a/shell-completion/bash/journalctl b/shell-completion/bash/journalctl
index 29bf6bca3f..3c40d57a98 100644
--- a/shell-completion/bash/journalctl
+++ b/shell-completion/bash/journalctl
@@ -18,9 +18,10 @@
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
__contains_word () {
- local word=$1; shift
- for w in $*; do [[ $w = $word ]] && return 0; done
- return 1
+ local w word=$1; shift
+ for w in "$@"; do
+ [[ $w = "$word" ]] && return
+ done
}
__journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC}
diff --git a/shell-completion/bash/localectl b/shell-completion/bash/localectl
index ef19f01461..bec9e78c64 100644
--- a/shell-completion/bash/localectl
+++ b/shell-completion/bash/localectl
@@ -18,9 +18,10 @@
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
__contains_word () {
- local word=$1; shift
- for w in $*; do [[ $w = $word ]] && return 0; done
- return 1
+ local w word=$1; shift
+ for w in "$@"; do
+ [[ $w = "$word" ]] && return
+ done
}
_localectl() {
diff --git a/shell-completion/bash/loginctl b/shell-completion/bash/loginctl
index 1844085d49..3104b305fa 100644
--- a/shell-completion/bash/loginctl
+++ b/shell-completion/bash/loginctl
@@ -18,9 +18,10 @@
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
__contains_word () {
- local word=$1; shift
- for w in $*; do [[ $w = $word ]] && return 0; done
- return 1
+ local w word=$1; shift
+ for w in "$@"; do
+ [[ $w = "$word" ]] && return
+ done
}
__get_all_sessions () { loginctl list-sessions | { while read -r a b; do printf "%s\n" "$a"; done; } ; }
diff --git a/shell-completion/bash/systemctl b/shell-completion/bash/systemctl
index ceca3348ed..517b49a6af 100644
--- a/shell-completion/bash/systemctl
+++ b/shell-completion/bash/systemctl
@@ -32,9 +32,10 @@ __systemd_properties() {
}
__contains_word () {
- local word=$1; shift
- for w in $*; do [[ $w = $word ]] && return 0; done
- return 1
+ local w word=$1; shift
+ for w in "$@"; do
+ [[ $w = "$word" ]] && return
+ done
}
__filter_units_by_property () {
diff --git a/shell-completion/bash/systemd-analyze b/shell-completion/bash/systemd-analyze
index 11276ef09c..33833aac10 100644
--- a/shell-completion/bash/systemd-analyze
+++ b/shell-completion/bash/systemd-analyze
@@ -19,9 +19,10 @@
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
__contains_word () {
- local word=$1; shift
- for w in $*; do [[ $w = $word ]] && return 0; done
- return 1
+ local w word=$1; shift
+ for w in "$@"; do
+ [[ $w = "$word" ]] && return
+ done
}
_systemd_analyze() {
diff --git a/shell-completion/bash/systemd-coredumpctl b/shell-completion/bash/systemd-coredumpctl
index 4bbece7347..805e84824e 100644
--- a/shell-completion/bash/systemd-coredumpctl
+++ b/shell-completion/bash/systemd-coredumpctl
@@ -18,9 +18,10 @@
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
__contains_word () {
- local word=$1; shift
- for w in $*; do [[ $w = $word ]] && return 0; done
- return 1
+ local w word=$1; shift
+ for w in "$@"; do
+ [[ $w = "$word" ]] && return
+ done
}
__journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC}
diff --git a/shell-completion/bash/timedatectl b/shell-completion/bash/timedatectl
index 2842b31069..c6a6545257 100644
--- a/shell-completion/bash/timedatectl
+++ b/shell-completion/bash/timedatectl
@@ -18,9 +18,10 @@
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
__contains_word () {
- local word=$1; shift
- for w in $*; do [[ $w = $word ]] && return 0; done
- return 1
+ local w word=$1; shift
+ for w in "$@"; do
+ [[ $w = "$word" ]] && return
+ done
}
_timedatectl() {
diff --git a/shell-completion/bash/udevadm b/shell-completion/bash/udevadm
index e9ad179203..e521a3bbb6 100644
--- a/shell-completion/bash/udevadm
+++ b/shell-completion/bash/udevadm
@@ -18,9 +18,10 @@
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
__contains_word () {
- local word=$1; shift
- for w in $*; do [[ $w = $word ]] && return 0; done
- return 1
+ local w word=$1; shift
+ for w in "$@"; do
+ [[ $w = "$word" ]] && return
+ done
}
__get_all_sysdevs() {