Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- context
- xargs
- IntelliJ
- tomcat
- Windows 10
- JavaScript
- Quartz
- bash
- DB 도메인
- port
- Mac
- Windows
- grep
- maVen
- 단축키
- VirtualBox
- lsof
- Eclipse
- copy-dependencies
- web.xml
- import
- resource
- netsh
- profile
- Source
- 공통표준용어
- 네트워크
- ssh
- find
- GIT
Archives
- Today
- Total
develog
[linux] heredoc, here document 본문
here document 문법
명령어 << EOF
# 여기에 서브 명령어를 입력
EOF
<< 를 사용하면 블럭 안에 탭이 적용된다
# test.sh
cat << EOF
aa
bb
cc
EOF
실행결과
$ ./test.sh
aa
bb
cc
<<- 를 사용하면 블럭 안에 탭이 무시된다
# test.sh
cat <<- EOF
aa
bb
cc
EOF
실행결과
$ ./test.sh
aa
bb
cc
변수 사용, 명령어 실행
- 변수 사용 : ${}
- 명령어 실행 : $()
# test.sh
message="hello world"
cat <<- EOF
# variable
message=${message}
# command
date=$(date)
EOF
실행결과
$ ./test.sh
# variable
message=hello world
# command
date=Thu 14 Mar 2024 12:28:49 AM UTC
sftp 사용 예제
sftp user01@127.0.0.1 <<- EOF
cd upload
ls
exit
EOF
Comments