IT/Linux
[Linux] cat << EOF > a.txt
frieden1946
2023. 1. 5. 14:49
here document, here-document, heredoc, hereis, here-string, here-script히어 문서, 히어 도큐먼트, 히어 다큐먼트, 히어 문자열, 히어닥
- 문자열을 쉘스크립트나 프로그래밍 언어 중에 그대로 포함시키기 위한 방법
- << 뒤에 식별자를 선언하고 원하는 문자열을 쓴 후에 식별자로 끝내면 된다.
- 지원환경·언어: UNIX 계열 쉘스크립트(sh, csh, ksh, bash, zsh), Perl, PHP, Python, Ruby 등
[root@zetawiki ~]# cat << EOF > a.txt
> hello
> world
> EOF
[root@zetawiki ~]# cat a.txt
hello
world
EOF는 End of File, EOT는 End of Text이라는 의미이다.
cat <<EOF > file1.txt
hello
world
EOF
user01@localhost:~$ cat <<EOF > file1.txt
> hello
> world
> EOF
user01@localhost:~$ cat file1.txt
hello
world
리눅스 cat <<EOF - 제타위키
다음 문자열 포함...
zetawiki.com