How to use \ t (tab) on outputs with EOF?

1

See the example below:

cat << EOF
alias\tVARIABLE = command
EOF

The run output does not take into account the regex \t .

    
asked by anonymous 23.12.2018 / 02:36

1 answer

1

cat does not interpret escape codes but there are several ways to do it, one of them is to use echo :

echo -e "alias\tVARIABLE = command"

That will return the string alias VARIABLE = command with the tab replaced.

Incidentally, by default, also does not interpret escapes and needs the -e parameter and this is unnecessary in the case of Dash strong>.

But if you really need the operation to go through echo , you can use process substitution:

cat <( echo -e "alias\tVARIABLE = command" )

That is, the output of cat will be sent to the input of echo as if it were an input file (such as cat ).

    
23.12.2018 / 14:53