Horje
heredoc remove leading space tabs linux bash Code Example
heredoc remove leading space tabs linux bash

If you don't need command substitution and parameter expansion inside your here-document, you can avoid using tabs by adding the leading spaces to the delimiter:

$     cat << '    EOF'
>         indented
>     EOF
        indented
$     cat << '    EOF' | sed -r 's/^ {8}//'
>         unindented
>     EOF
unindented
heredoc remove leading space tabs linux bash
mail_content="Last Change: $dateLastChanged

    This is an automated warning of stale data for the UNC-G Blackboard Snapshot process."
    mailx -r "Systems and Operations <sysadmin@[redacted].edu>" -s "Warning Stale BB Data" jadavis6@[redacted].edu <<<"$mail_content"
heredoc remove leading space tabs linux bash

You can change the here-doc operator to <<-. You can then indent both the here-doc and the delimiter with tabs:

#! /bin/bash
cat <<-EOF
    indented
    EOF
echo Done
heredoc remove leading space tabs linux bash
sed 's/^ *//' >> ~/Desktop/text.txt << EOF
    Load time-out reached and nothing to resume.
    $(date +%T) - Transmission-daemon exiting.
EOF




Shell

Related
How do I reset the git master branch to the upstream branch in a forked repository? Code Example How do I reset the git master branch to the upstream branch in a forked repository? Code Example
installing plesk on linux Code Example installing plesk on linux Code Example
linux install software without sudo Code Example linux install software without sudo Code Example
vant github Code Example vant github Code Example
installing flow globally Code Example installing flow globally Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11