Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

heredoc remove leading space linux bash

usage () {
    # No tabs necessary!
    readarray message <<'    EOF'
        Hello, this is a cool program.
        This should get unindented.
        This code should stay indented:
            something() {
                echo It works, yo!;
            }
        That's all.
    EOF
    # Each line is indented an extra 8 spaces, so strip them
    printf '%s' "${message[@]#        }"
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #heredoc #remove #leading #space #linux #bash
ADD COMMENT
Topic
Name
4+2 =