사용자 도구

사이트 도구


linux:shell_script

문서의 이전 판입니다!


Linux/Unix shell script

pipe 출력 결과를 그대로 실행하기

ls | sed ... | source /dev/stdin

Script 안에서 특정 내용의 파일 생성하기

cat <<EOF >/home/a.config
first line
second line
third line
EOF

다른 명령 Stream 으로부터 지속적으로 결과 읽어서 처리하기

find . -type f |
while read -r line
do
    echo "$line"
done
 
# one liner
find . -type f | while read -r line; do echo "$line"; done
 
 
# 혹은
 
while read -r line
do
    echo "$line"
done < <(find . -type f)

참조

linux/shell_script.1652241536.txt.gz · 마지막으로 수정됨: 2022/05/11 12:58 저자 kwon37xi