Insert escaped characters in seq command separator
- by dhekir
How do I insert a string containing escaped characters (\n, \t, etc) as separator for the seq command?
The standard format includes a newline character:
$ seq 3
1
2
3
But if I try to add something plus a newline, the backslash is escaped and a literal "\n" is used instead:
$ seq -s "$\n" 3
1\n2\n3
The same happens using simple quotes, no quotes, or other escaped characters:
$ seq -s "\t" 3
1\t2\t3
$ seq -s \t 3
1t2t3
This is not the standard behavior for commands such as echo, so I'm a bit confused here...
Edit: Ideally, I'd like a somewhat portable solution (that works in tsch as well as bash, for instance), and without resorting to Perl or other languages.