strange `printf` arguments, parsing features (bugs?)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



# (1) parameters to `printf`?

olecom@flower:/tmp$ sh -c 'printf "-1"'
printf: 1: Illegal option -1

# (2) parsing features?

olecom@flower:/tmp$ sh -c 'echo 1; } echo 2'
1
2
olecom@flower:/tmp$ sh -c '} echo 2'
sh: Syntax error: "}" unexpected
olecom@flower:/tmp$ sh -c 'echo 2; }'
2
olecom@flower:/tmp$

# (3) '\' in `` and in $();
# what is POSIX "literal meaning" of '\' in `` and what is '\\' then?
# bash has its own opinion

olecom@flower:/tmp$ PS2=''
olecom@flower:/tmp$ dash -s << '='
`echo ' \' >&2`
`echo ' \\' >&2`
`echo ' \\\' >&2`
`echo ' \\\\' >&2`
$(echo ' \' >&2)
$(echo ' \\' >&2)
$(echo ' \\\' >&2)
$(echo ' \\\\' >&2)
echo --
$(echo ' \\\\\' >&2)
`echo  ' \\\\\' >&2`
=
 \
 \
 \
 \
 \
 \
 \\
 \\
--
 \\\
 \\
olecom@flower:/tmp$ bash -s << '='
`echo ' \' >&2`
`echo ' \\' >&2`
`echo ' \\\' >&2`
`echo ' \\\\' >&2`
$(echo ' \' >&2)
$(echo ' \\' >&2)
$(echo ' \\\' >&2)
$(echo ' \\\\' >&2)
echo --
$(echo ' \\\\\' >&2)
`echo  ' \\\\\' >&2`
=
 \
 \
 \\
 \\
 \
 \\
 \\\
 \\\\
--
 \\\\\
 \\\
olecom@flower:/tmp$
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux