Skip to content

Commit

Permalink
Work around ancient shells where >$3 does not implicitly quote $3.
Browse files Browse the repository at this point in the history
Also add an entry in shelltest.od to reject any shell exhibiting that
bug.

Reported-by: Wayne Scott <[email protected]>
  • Loading branch information
apenwarr committed Mar 4, 2019
1 parent 7895c94 commit 2bea74d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/cookbook/c/hello world.list.od
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ redo-ifchange "$S/sources"
done | uniq

printf '%s\n' "$LIBGTK2" "$LIBQT4"
) >$3
) >"$3"

redo-stamp <$3
redo-stamp <"$3"
12 changes: 12 additions & 0 deletions t/shelltest.od
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,18 @@ x2=$(cd shlink && basename "$(pwd -L)")
[ "$x1" = "t" ] || fail 122
[ "$x2" = "shlink" ] || fail 123

# Reported by Wayne Scott on FreeBSD 7.0 (ancient). Apparently the sh (or
# bash?) there prints "$3: ambiguous redirect" if you redirect to it without
# putting the $3 in quotes (ie >"$3"). I hadn't seen that before, even
# though it's not obvious to most sh users that the > argument is implicitly
# quoted.
set a b "shelltest.tmp log.tmp"
rm -f "$3" $3
echo hello >$3 || fail 130
[ -e "$3" ] || fail 131
[ ! -e "shelltest.tmp" ] || fail 132
rm -f "$3" $3

[ -e shelltest.failed ] && exit 41
[ -e shelltest.warned ] && exit 42
exit 40

0 comments on commit 2bea74d

Please sign in to comment.