Test environment:
$ mkdir testdir
$ cd testdir
$ echo | tee "file
name"
Now, ls
will print file?name
(under Ubuntu GNU bash, at least), while ls | cat
will print file
and name
in separate lines.
What I'd like to achieve is, print file?name
with the piped version, so something like
$ something ls | cat` or `ls | something | cat` or `ls | something cat
In other words, how to fool a command like ls
here into thinking, it has a TTY, when it does not, in the shell?
Note: ls
is just an example program here, I'm looking for generic solution, not program specific like ls -q | cat
would be.