Updated SC2039 (markdown)

Mingye Wang
2016-02-26 06:00:59 -05:00
parent fd0941da1c
commit cd2fcca16e

@@ -101,7 +101,8 @@ grep aaa <<< "$g"
POSIX: POSIX:
```sh ```sh
printf '%s' "$g" | grep aaa # since we want to avoid `echo` # not exactly the same -- <<< adds a trailing \n if $g doesn't end with \n
printf '%s' "$g" | grep aaa
``` ```
### echo flags ### echo flags
@@ -138,7 +139,10 @@ POSIX:
# TODO: Interpret it back to printf escapes for hard-to-copy chars like \t? # TODO: Interpret it back to printf escapes for hard-to-copy chars like \t?
# See also: http://git.savannah.gnu.org/cgit/libtool.git/tree/gl/build-aux/funclib.sh?id=c60e054#n1029 # See also: http://git.savannah.gnu.org/cgit/libtool.git/tree/gl/build-aux/funclib.sh?id=c60e054#n1029
reuse_quote()( reuse_quote()(
for i; do echo -n \'; echo -n "$i" | sed -e "s/'/'\\\\''/g"; echo -n "' "; done for i; do
__i_quote=$(printf '%s\n' "$i" | sed -e "s/'/'\\\\''/g"; echo x)
printf "'%s'" "${__i_quote%x}"
done
) )
reuse_quote "$@" reuse_quote "$@"
``` ```