How do I execute a PHP shell script as an Automator action on Mac OS X

前端 未结 5 1117
时光说笑
时光说笑 2020-12-25 08:54

I\'m tempted by Automator.app\'s ability to create contextual services in Mac OS X Snow Leopard. I would like to create some keyboard accessible shortcuts to manipulate text

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-25 09:06

    dbr's solution above is excellent, but I found that it didn't work for me, perhaps due to a later change in the shell, php, or OS version (I'm using OS X 10.8). After a lot of head-scratching I found that the answer is to quote the heredoc marker.

    A useful addition is to use the appropriate syntax to pass the arguments through to the php script. Putting all that together, I'm using:

    php -- "$@" <<'EOF'
    
    EOF
    

提交回复
热议问题