Skip to main content

I assigned a var like this:

MYCUSTOMTAB=' ' 

But using it in echo both:

echo $MYCUSTOMTAB"blah blah" 

or

echo -e $MYCUSTOMTAB"blah blah" 

just returnreturns a single space and the rest of the string:

 blah blah 

How can I print the full string untouched without having it being randomly raped by the echo command? I want to use it for have a custom indent because \t is too much wide for my tastes.

I assigned a var like this:

MYCUSTOMTAB=' ' 

But using it in echo both:

echo $MYCUSTOMTAB"blah blah" 

or

echo -e $MYCUSTOMTAB"blah blah" 

just return a single space and the rest of the string:

 blah blah 

How can I print the full string untouched without having it being randomly raped by the echo command? I want to use it for have a custom indent because \t is too much wide for my tastes.

I assigned a var like this:

MYCUSTOMTAB=' ' 

But using it in echo both:

echo $MYCUSTOMTAB"blah blah" 

or

echo -e $MYCUSTOMTAB"blah blah" 

just returns a single space and the rest of the string:

 blah blah 

How can I print the full string untouched? I want to use it for have a custom indent because \t is too much wide for my tastes.

Post Closed as "Duplicate" by Gilles 'SO- stop being evil' bash
Source Link
user3450548
  • 3.1k
  • 13
  • 37
  • 56

How do I echo a string with multiple spaces in bash "untouched"?

I assigned a var like this:

MYCUSTOMTAB=' ' 

But using it in echo both:

echo $MYCUSTOMTAB"blah blah" 

or

echo -e $MYCUSTOMTAB"blah blah" 

just return a single space and the rest of the string:

 blah blah 

How can I print the full string untouched without having it being randomly raped by the echo command? I want to use it for have a custom indent because \t is too much wide for my tastes.