[PATCH] Fix several quoting of $@
by Roman Rakus
Unquoted $@ should make troubles when parameters contains spaces.
Signed-off-by: Roman Rakus <rrakus(a)redhat.com>
---
src/infrastructure.sh | 6 +++---
src/logging.sh | 6 +++---
src/testing.sh | 6 +++---
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/infrastructure.sh b/src/infrastructure.sh
index f625604..b88959a 100644
--- a/src/infrastructure.sh
+++ b/src/infrastructure.sh
@@ -459,7 +459,7 @@ rlServiceStart() {
local failed=0
- for service in $@; do
+ for service in "$@"; do
service $service status
local status=$?
@@ -542,7 +542,7 @@ rlServiceStop() {
local failed=0
- for service in $@; do
+ for service in "$@"; do
service $service status
local status=$?
@@ -618,7 +618,7 @@ rlServiceRestore() {
local failed=0
- for service in $@; do
+ for service in "$@"; do
# if the original state hasn't been saved, then something's wrong
local wasRunning="__INTERNAL_SERVICE_STATE_$(echo $service|sed 's/[^a-zA-Z]//g')"
if [ -z "${!wasRunning}" ]; then
diff --git a/src/logging.sh b/src/logging.sh
index e479243..1f39801 100644
--- a/src/logging.sh
+++ b/src/logging.sh
@@ -239,7 +239,7 @@ rlBundleLogs(){
rlLogDebug "rlBundleLogs: Creating directory for logs: $LOGDIR"
mkdir -p "$LOGDIR"
- for i in $@; do
+ for i in "$@"; do
local i_new="$( echo $i | sed 's|[/ ]|_|g' )"
while [ -e "$LOGDIR/$i_new" ]; do
i_new="${i_new}_next"
@@ -394,7 +394,7 @@ rlShowPackageVersion()
rlLogWarning "rlShowPackageVersion: Too few options"
return 1
fi
- for pkg in $@; do
+ for pkg in "$@"; do
if rpm -q $pkg &> /dev/null; then
IFS=$'\n'
for line in $(rpm -q $pkg --queryformat "$pkg RPM version: %{version}-%{release}.%{arch}\n")
@@ -413,7 +413,7 @@ rlShowPackageVersion()
# backward compatibility
rlShowPkgVersion() {
rlLogWarning "rlShowPkgVersion is obsoleted by rlShowPackageVersion"
- rlShowPackageVersion $@;
+ rlShowPackageVersion "$@";
}
diff --git a/src/testing.sh b/src/testing.sh
index 892c0b6..ce6ef54 100644
--- a/src/testing.sh
+++ b/src/testing.sh
@@ -907,7 +907,7 @@ __INTERNAL_rlIsDistro(){
[ -z "$1" ] && return 0
- for arg in $@
+ for arg in "$@"
do
if [ "$arg" == "$whole" ] || [ "$arg" == "$major" ]
then
@@ -942,7 +942,7 @@ Returns 0 if we are running RHEL 4.8 or any RHEL 5.
=cut
rlIsRHEL(){
- __INTERNAL_rlIsDistro "Red Hat Enterprise Linux" $@
+ __INTERNAL_rlIsDistro "Red Hat Enterprise Linux" "$@"
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -967,7 +967,7 @@ Returns 0 if we are running Fedora 9 or 10.
=cut
rlIsFedora(){
- __INTERNAL_rlIsDistro "Fedora" $@
+ __INTERNAL_rlIsDistro "Fedora" "$@"
}
: <<'=cut'
--
1.7.6.4
12 years, 6 months