[완료]쉘스크립트 알려주세요!!

jin24512의 이미지

쉘 스크립트 로그파일 남기는걸 공부하고있습니다!!

command &>leelog/leelog-`date "+%Y%m%d%H%M"`.log
요렇게 해서 실행내용과 날짜별 로그파일이 실행했습니다!!

그런데!!

command1 &>leelog/leelog-`date "+%Y%m%d%H%M"`.log
command2 &>leelog/leelog-`date "+%Y%m%d%H%M"`.log

요렇게 써넣으니까 command2 번의 실행내용만 로그파일에 쌓이는 거예요 ㅠㅠ
같은이름의 로그파일 내에 실행한 command의 내용이 차곡차곡 쌓이게 하는 명령어좀 알려주세요 ㅠㅠ

>> 이렇게 하니까 되네요! 감사합니다!

planetarium의 이미지

> 대신 >> 를 쓰시면 됩니다.

jin24512의 이미지

command1 &>leelog/leelog-`date "+%Y%m%d%H%M"`.log
command2 &>>leelog/leelog-`date "+%Y%m%d%H%M"`.log
이런 식으로요?

./shell.sh: line 3: syntax error near unexpected token `>'
./shell.sh: line 3: `df -h &>>leelog/leelog-`date "+%Y%m%d%H%M"`.log'
요런식의 에러가 ㅠㅠ

우앗! 해결됬습니다!! 감사합니다!!!