User input in Automator's "Run Shell Script" I have a Folder Action on a /Volumes folder. I'm checking when a specific disk is mounted (folder in /Volumes created), checking ssh to remote computer. If all present I run rsync there.

It was OK when number of files was low. Now only rsync's "building file list" takes 40 minutes. I want this action to ask before rsync for my decision. Better with osascript.

source="/Volumes/MyDisk/FolderToSync"

user="username"
host="myhost"
port="22"
path="/RemoteFolder/"

log="$HOME/RSync_$(date +%Y.%m.%d_%H-%M-%S).log"
rm $HOME/RSync_$(date -v-1m +%Y.%m.)*.log

if [ -d "$source" ]; then

    nc -z $host $port &gt; /dev/null   

    if [ $? -eq 0 ]; then
        touch $log;

        osascript -e 'display notification "Do you want to RSync now?" with title "ssh"'

        rsync -czvaEP --delete --log-file=$log "$source" -e "ssh -p$port" $user@$host:$path;

    fi
fi
Using display notification will be of no use since its result is none, use a display dialog instead.

The follow is an example of how I'd do it:

result="$(osascript -e '(display dialog "Do you want to Rsync now?" buttons {"No", "Yes"} default button 2 with title "ssh")')"
if [ "$result" == "button returned:Yes" ]; then
    rsync -czvaEP --delete --log-file=$log "$source" -e "ssh -p$port" $user@$host:$path;
fi




Shown within the relevant code posted in the OP:

source="/Volumes/MyDisk/FolderToSync"

user="username"
host="myhost"
port="22"
path="/RemoteFolder/"

log="$HOME/RSync_$(date +%Y.%m.%d_%H-%M-%S).log"
rm $HOME/RSync_$(date -v-1m +%Y.%m.)*.log

if [ -d "$source" ]; then

    nc -z $host $port &gt; /dev/null   

    if [ $? -eq 0 ]; then
        touch $log;
        result="$(osascript -e '(display dialog "Do you want to Rsync now?" buttons {"No", "Yes"} default button 2 with title "ssh")')"
        if [ "$result" == "button returned:Yes" ]; then
            rsync -czvaEP --delete --log-file=$log "$source" -e "ssh -p$port" $user@$host:$path;
        fi
    fi
fi