From 81ae556f8b9bd40b61912f2e7ddebcd80b1b674c Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Thu, 26 Jan 2012 13:04:23 -0700 Subject: [PATCH] Use local IFS. --- bin/pt-stalk | 9 ++------- lib/bash/parse_options.sh | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/bin/pt-stalk b/bin/pt-stalk index 97d4ba59..cb6d872c 100755 --- a/bin/pt-stalk +++ b/bin/pt-stalk @@ -166,12 +166,10 @@ parse_options() { shift # --config local user_config_files="$1" shift # that ^ - local old_ifs="$IFS" - IFS="," + local IFS="," for user_config_file in $user_config_files; do _parse_config_files "$user_config_file" done - IFS="$old_ifs" else _parse_config_files "/etc/percona-toolkit/percona-toolkit.conf" "/etc/percona-toolkit/$TOOL.conf" "$HOME/.percona-toolkit.conf" "$HOME/.$TOOL.conf" fi @@ -214,8 +212,7 @@ _parse_pod() { } _eval_po() { - local old_ifs="$IFS" - IFS=":" + local IFS=":" for opt_spec in "$PO_DIR"/*; do local opt="" local default_val="" @@ -265,8 +262,6 @@ _eval_po() { eval "OPT_${opt}"="$default_val" done - - IFS="$old_ifs" } _parse_config_files() { diff --git a/lib/bash/parse_options.sh b/lib/bash/parse_options.sh index 6320c0f3..3c2ac8c9 100644 --- a/lib/bash/parse_options.sh +++ b/lib/bash/parse_options.sh @@ -192,12 +192,10 @@ parse_options() { shift # --config local user_config_files="$1" shift # that ^ - local old_ifs="$IFS" - IFS="," + local IFS="," for user_config_file in $user_config_files; do _parse_config_files "$user_config_file" done - IFS="$old_ifs" else _parse_config_files "/etc/percona-toolkit/percona-toolkit.conf" "/etc/percona-toolkit/$TOOL.conf" "$HOME/.percona-toolkit.conf" "$HOME/.$TOOL.conf" fi @@ -252,8 +250,7 @@ _eval_po() { # Evaluate the program options into existence as global variables # transformed like --my-op == $OPT_MY_OP. If an option has a default # value, it's assigned that value. Else, it's value is an empty string. - local old_ifs="$IFS" - IFS=":" + local IFS=":" for opt_spec in "$PO_DIR"/*; do local opt="" local default_val="" @@ -305,8 +302,6 @@ _eval_po() { # Eval the option into existence as a global variable. eval "OPT_${opt}"="$default_val" done - - IFS="$old_ifs" } _parse_config_files() {