Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Issue with string slices



2019-06-17 11:05:32 +0200, Roman Perepelitsa:
> To print $something as is, use one of these forms:
> 
>   echo -nE - "$something"
>   print -nr -- "$something"
>   printf '%s' "$something"
> 
> The first two are ZSH specific, the last is portable. ZSH also allows
> you to omit quotes here unless SH_WORD_SPLIT option is set.
[...]

The second one comes from ksh, it's not zsh-specific and
predates POSIX, let alone POSIX's printf, but nowadays is not as
portable as printf.

If you want to target zsh and ksh only, "print" may be more
desirable as there are still some pdksh derivatives where printf
is not built-in.

"unless SH_WORD_SPLIT *or GLOB_SUBST* is set"

-- 
Stephane



Messages sorted by: Reverse Date, Date, Thread, Author