diff options
author | H.Merijn Brand <h.m.brand@xs4all.nl> | 2016-05-29 18:10:20 +0200 |
---|---|---|
committer | Raphael Manfredi <Raphael_Manfredi@pobox.com> | 2016-05-29 18:10:20 +0200 |
commit | cfaabf4a42cf72bf61187950a8bc8f082a5f6a2f (patch) | |
tree | e5606ee4e368aece4fab0569a667cc55bd2160e9 /mcon/U | |
parent | 84ae62697098fdaccc0bc97df67f7d5ea8878239 (diff) |
Escape ~ as some shells expand tilde during here-doc expansion (#6)
Could it be that some broken shells would expand the leading ~ during
the here-document processing?
If that is so, my suggestion is to include ?X: lines in the unit to
explicitly document that fact so that nobody mistakenly removes the
escaping later on, thinking it is not required.
This is my guess, but I have never encountered that problem anywhere, which
is why the "official" dist does not escape the ~.
However, Perl is compiled in much more diverse platorms as gtk-gnutella is
so it would not surprise me... the hard part will be to remember on which
platform the problem was spotted :-)
Cheers,
Raphael
Diffstat (limited to 'mcon/U')
-rw-r--r-- | mcon/U/Filexp.U | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mcon/U/Filexp.U b/mcon/U/Filexp.U index bf768b1..31e57a5 100644 --- a/mcon/U/Filexp.U +++ b/mcon/U/Filexp.U @@ -31,11 +31,15 @@ cat >filexp <<EOSS $startsh : expand filename +?X: +?X: The case entries below escape the ~ as some shells have shown expansion +?X: of the ~ during here-doc processing. +?X: case "\$1" in - ~/*|~) + \~/*|\~) echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|" ;; - ~*) + \~*) if $test -f /bin/csh; then /bin/csh -f -c "glob \$1" failed=\$? |