본문 바로가기
따배셸

[따배셸] 4. Bash shell과 Rules 2

by Engineer-Lee 2022. 11. 14.
반응형

ex) echo “This is a test” > message.txt

“This is a test”라는 텍스트가 message.txt 파일에 저장된다.

 

ex) mailx s “SAMPLE MAIL” ubuntu@localhost 0< message.txt

message.txt 파일의 내용을 ubuntu@localhost 이라는 메일주소에 SAMPLE MAIL이라는 제목으로 메일을 보낸다.

 

 

ex)

date > date.txt
date >> date.txt

Wed Nov 9 06:20:10 UTC 2022

Wed Nov 9 06:20:49 UTC 2022

>> 를 사용하면 내용을 덮어쓰지 않고 append 해준다.

 

ex)

에러 메시지 또한 redirection 할 수 있다.

 

 

ex) ls a | grep txt

txt가 들어간 파일들을 검색한다.

반응형

'따배셸' 카테고리의 다른 글

[따배셸] 8. Branching  (0) 2025.02.13
[따배셸] 7. Input&Output  (0) 2025.02.13
[따배셸] 6. Positional Parameters  (0) 2025.02.13
[따배셸] 5. Bash shell script란  (0) 2022.11.14
[따배셸] 1강~3강  (0) 2022.11.14