📄 heredoc.tests
字号:
# check order and content of multiple here docscat << EOF1 << EOF2 hiEOF1thereEOF2while read line1; do read line2 <&3 echo $line1 - $line2done <<EOF1 3<<EOF2onetwothreeEOF1alphabetagammaEOF2# check quoted here-doc is protecteda=foocat << 'EOF'hi\there$astuffEOF# check that quoted here-documents don't have \newline processing donecat << 'EOF'hi\thereEO\FEOFtrue# check that \newline is removed at start of here-doccat << EO\FhiEOF# check that \newline removal works for here-doc delimitercat << EOFhiEO\F# check operation of tab removal in here documentscat <<- EOF tab 1 tab 2 tab 3 EOF# check appending of text to file from here documentrm -f /tmp/bash-zzzcat > /tmp/bash-zzz << EOFabcEOFcat >> /tmp/bash-zzz << EOFdef ghijkl mnoEOFcat /tmp/bash-zzzrm -f /tmp/bash-zzz# make sure command printing puts the here-document as the last redirection# on the line, and the function export code preserves syntactic correctnessfff(){ ed /tmp/foo <<ENDOFINPUT >/dev/null/^name/dwqENDOFINPUTaa=1}type fffexport -f fff${THIS_SH} -c 'type fff'${THIS_SH} ./heredoc1.subecho $( cat <<< "comsub here-string")# check that end of file delimits a here-document# THIS MUST BE LAST!cat << EOFhithere
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -