shell tools: Quote the arguments to tr

This commit is contained in:
Brian Fraser fraserb@gmail.com
2012-08-13 12:23:18 -03:00
parent 217a45df6f
commit 7f9f84a6d0
6 changed files with 22 additions and 22 deletions

View File

@@ -23,7 +23,7 @@ PTDEBUG="${PTDEBUG:-""}"
EXIT_STATUS=0
log() {
TS=$(date +%F-%T | tr :- _);
TS=$(date +%F-%T | tr ':-' '_');
echo "$TS $*"
}
@@ -122,7 +122,7 @@ usage_or_errors() {
echo "Options and values after processing arguments:"
echo
for opt in $(ls "$PO_DIR"); do
local varname="OPT_$(echo "$opt" | tr a-z- A-Z_)"
local varname="OPT_$(echo "$opt" | tr 'a-z-' 'A-Z_')"
local varvalue="${!varname}"
if ! grep -q "type:" "$PO_DIR/$opt" >/dev/null; then
if [ "$varvalue" -a "$varvalue" = "yes" ];
@@ -240,7 +240,7 @@ _eval_po() {
while read key val; do
case "$key" in
long)
opt=$(echo $val | sed 's/-/_/g' | tr [:lower:] [:upper:])
opt=$(echo $val | sed 's/-/_/g' | tr '[:lower:]' '[:upper:]')
;;
default)
default_val="$val"
@@ -406,7 +406,7 @@ _parse_command_line() {
fi
if [ "$opt_is_ok" ]; then
opt=$(cat "$spec" | grep '^long:' | cut -d':' -f2 | sed 's/-/_/g' | tr [:lower:] [:upper:])
opt=$(cat "$spec" | grep '^long:' | cut -d':' -f2 | sed 's/-/_/g' | tr '[:lower:]' '[:upper:]')
if grep "^type:size" "$spec" >/dev/null; then
val=$(size_to_bytes $val)