“heredoc hapus tab ruang terkemuka linux bash” Kode Jawaban

heredoc hapus tab ruang terkemuka 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
DreamCoder

heredoc hapus tab ruang terkemuka linux bash

sed 's/^ *//' >> ~/Desktop/text.txt << EOF
    Load time-out reached and nothing to resume.
    $(date +%T) - Transmission-daemon exiting.
EOF
DreamCoder

heredoc hapus tab ruang terkemuka 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
DreamCoder

heredoc hapus tab ruang terkemuka 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"
DreamCoder

Jawaban yang mirip dengan “heredoc hapus tab ruang terkemuka linux bash”

Pertanyaan yang mirip dengan “heredoc hapus tab ruang terkemuka linux bash”

Lebih banyak jawaban terkait untuk “heredoc hapus tab ruang terkemuka linux bash” di Shell/Bash

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya