1

I'm writing a simple service to open a file in Emacs through selection in Finder.


    for f in $@
    do
    open -a Emacs "$f"
    done

If a file is selected in Finder (solid blue on the file after left click), and the service is called, the script runs twice for any selected files.

If I right click on a file without selecting it (clear box after right click) and call the service, then the action is performed once.

There is no Automator service of "getting Finder items" above this script.

Why is the service being called twice if a file is selected (left click on a file) but only once if selected with a right click?

  • Just an FYI, you really should have quotes around $@, e.g. "$@" to avoid re-splitting elements of the array. – user3439894 Dec 24 '18 at 16:54
  • Perhaps a screenshot of your entire workflow would be helpful. – CJK Dec 24 '18 at 20:15

You must log in to answer this question.

Browse other questions tagged .