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
- bash
- Proxy
- ELASTIC
- pfsense
- Kibana server is not ready yet
- centos 8
- 보안양파
- ansible
- freebsd
- G-suite
- macos
- docker
- x-pack
- PlayBook
- application security
- XCP-ng
- elastic stack
- Windows
- ssh key 배포
- GitLab
- endpoint security
- miniconda
- 로그인불가
- hardening
- Elasticsearch
- xe guest utilities
- Kibana
- proxycfg
- 한글가이드
Archives
- Today
- Total
선 밖에 선 자유인
라인 단위 읽기 (쉘 스크립트) 본문
** 각 라인별로 ssh 작업 등을 할 때는 구) 의 내용은 에러가 발생한다.
아래와 같이 cat 으로 파일을 열어 라인별로 받아오는 방법을 권장
#!/bin/bash
exec < [파일명]
while read line
do
echo $line
done
or
#!/bin/bash
for line in `cat test.txt`
<실행 명령어> $line
done
** line에 띄어쓰기가 있는 경우 문제됨
---------------------------------------------
구)
#!/bin/bash
for file in 'test.txt' ; do
while read line ; do
<실행 명령어> $line
done < $file
done
Comments