I have a Zsh script which invokes another program. One of the paramters to be passed, should be a literal tab, i.e what in common programming languages is often written as "\t".
If it were bash, I think I could use the special form
$"\t"
but this doesn't seem to work (the called program sees a two-character string, backslash and t). I also tried putting octal code using $`010`, but no effect either (this is simply received as 010).
While $'\t' is easy to read and works in many current shells, it isn't in the standards yet and is not implemented by many shells in common use. Standard ways that should be supported by any shell based on Bourne shell syntax include:
utility_name " " # where there is a literal tab character between the double-quote characters
utility_name ' ' # where there is a literal tab character between the single-quote characters
utility_name "$(printf '\t')" # for modern shells
utility_name "$(printf '\011')" # for modern shells
utility_name "`printf '\t'`" # for 1980's vintage Bourne shells
and, of course, you can define a variable using any of those forms: