Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Bash Echo 4-step indentation

I’m trying to run this script to a file and I would like to add 4-step indent before each of the bullet points. Right now it seems to be doing a smaller indentation for the bullet points.

echo -e "\nHEADING
bullet point 1
bullet point 2
bullet point 3" >> todo.txt

Desired result todo.txt:

HEADING
    bullet point 1
    bullet point 2
    bullet point 3

How can I apply the 4-step indent to only the last 3 lines only?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You’re using quotes already. Just format it the way you want it to look.

$: echo "
HEADING
    bullet point 1
    bullet point 2
    bullet point 3
"

HEADING
    bullet point 1
    bullet point 2
    bullet point 3

Does the same if you send to a file.

$: echo "
HEADING
    bullet point 1
    bullet point 2
    bullet point 3
" >file
$: cat file

HEADING
    bullet point 1
    bullet point 2
    bullet point 3

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading