2016-08-11 9 views
2

です。<<の使用法は私には分かりませんが、誰も簡単な例で説明できますか?本当にそれを感謝します。リダイレクション演算子が1つわからず、それは<<

+4

[Bashのリファレンスマニュアル:3.6.6ヒアドキュメント](https://www.gnu.org/software/bash/manual/html_node/Redirections.html) –

+1

あるいは、コンピュータ上で 'man bash'を開いて' << 'を検索してください。 – John1024

答えて

2
cat <<'EOF' 
hello $$ 
I'm a here document that doesn't interpolate 
any $-variables because of the qutoes around 
the EOF marker 
EOF 

echo ------- 

cat <<EOF 
hello $$ 
I'm a here document that does interpolate 
EOF 

echo ------- 

cat <<x 
It doesn't matter what you use as the end of file marker 
x 

echo ------- 

cat <<'x' 
Quotes prevent $-interpolation 
x 

出力:

hello $$ 
I'm a here document that doesn't interpolate 
any $-variables because of the qutoes around 
the EOF marker 
------- 
hello 29843 
I'm a here document that does interpolate 
------- 
It doesn't matter what you use as the end of file marker 
------- 
Quotes prevent $-interpolation 
関連する問題