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 |
Tags
- Source
- find
- ssh
- grep
- netsh
- xargs
- bash
- JavaScript
- Windows
- web.xml
- 줄바꿈 문자
- port
- resource
- plugin
- lsof
- tomcat
- IntelliJ
- vscode
- import
- profile
- Eclipse
- 네트워크
- VirtualBox
- Mac
- Quartz
- 단축키
- maVen
- Windows 10
- context
- GIT
Archives
- Today
- Total
develog
[linux] heredoc, here document 본문
here document 문법
명령어 << EOF
# 여기에 서브 명령어를 입력
EOF
<< EOF, <<EOF 로 실행시 결과는 동일 (중간에 공백 여부 상관없음)
# test.sh
cat << EOF
aa
bb
cc
EOF
실행결과 -> 블럭 안에 탭이 적용된다
$ ./test.sh
aa
bb
cc
<<- EOF, <<-EOF 로 실행시 결과는 동일 (중간에 공백 여부 상관없음)
# 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