Echoing statements in bash script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Using a bash script I want to echo several strings to a file. The echo statement, however, is in a function and thus indented but I do /not/ want the strings echoed indented in the new file. Is this doable?

Here is an example:

f () {

    echo "

    # this is a test

    a=123

    b=456" > file.txt

}

File.txt should the contain:

# this is a test

a=123

b=456

Thus no indentation. It seems that if I prepend each line with \b the line should be backspaced which would work nicely but the echo statement seems to replace a backspace within the quotes to spaces...


_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux