Cygwin Wiki
Advertisement
Forums: Index > Help desk > Inotify-win in bash script on cygwin?


I'm using the inotify-win executable under cygwin to watch the "created" event in a directory on one of my servers. I'd like to put it in a script ... called something like lstail or similar, and run the script, rather than constantly having to enter the entire thing... but I can't get it to run as a script under cygwin bash...


Here's my command sequence:

WATCH=.

inotifywait -q -m -e create --format %f $WATCH | while read event
do
ls -tr $WATCH/$event
done


When I put it in a script, here's what I get:

$ lstail
/usr/bin/lstail: line 2: $'\r': command not found
/usr/bin/lstail: line 6: syntax error near unexpected token `done'
/usr/bin/lstail: line 6: `done'

I have no idea why this is. Can anyone help me out here?


TIA

Curtis Reynolds



Hi,

you use the windows line eding "\r\n" instead of the unix line endings "\n".



Regards,

Christian

Advertisement