I'm ver unfamiliar with writing shell scripts but I am trying to write a script that checks whether a file is currently open before executing a command. I'm getting the following error
./Script.sh: line 9: syntax error near unexpected token `done'
./Script.sh: line 9: `done'
As a bonus I don't know that the "|"
operator does I've found a few shell syntax sites but since its a single character searching for its purpose has been difficult.
#!/bin/bash
inotifywait -m -r -e create "sunshine" | while read NEWFILE
do
if [ lsof | grep NEWFILE ]; then
echo "found something";
else
aws s3 sync sunshine s3://turnaround-sunshine/
done