2017-09-13 2 views
3

이 스크립트가 왜 두 개의 전자 메일을 보내는 대신 왜 두 개의 전자 메일을 보냅니 까?이 간단한 전자 메일 스크립트가 매번 두 개의 전자 메일을 보내는 이유

#!/bin/sh 
MONITORDIR="/path/to/directory" 
inotifywait -m -r -e create --format '%w%f' "${MONITORDIR}" | while read 
NEWFILE 
do 
[ -z "${NEWFILE}" ] && : || MOVIE=$(find "$NEWFILE" -type f -not -name ".*" 
\(-iname "*.mkv" -o -iname "*.mp4" -o -iname "*.avi" \) -exec basename {} 
\; | sed 's/\.[^.]*$//') 
[ -z "${MOVIE}" ] && : || echo "Please don't reply to this 
automatically generated email message." | mail -s "$MOVIE is now on Plex!" 
"[email protected],[email protected]" 
done 
+0

두 번째 마지막 줄에있는 두 개의 이메일 주소를 하나로 대체하려고 시도 했습니까? – Syfer

+0

@Syfer 두 개의 전자 메일입니다. –

+0

그냥 확인, 그것은 두 이메일 주소로 동일한 이메일을 두 번 보내시겠습니까? – swapnilsm

답변

2
[ -z "${MOVIE}" ] && : || echo "Please don't reply to this 

참고 A && B || Cif-then-else 없습니다. A가 참일 때 C가 실행될 수 있습니다.