3

I want to run this command in Terminal via AppleScript but Script Editor doesn't like the dollar sign. It says: Syntax Error: Expected end of line but found unknown token. How can I enter this command into Terminal without Script Editor complaining? I'm totally new to this and this command is not mine, I don't really want to change it.

tell application "Terminal"
do script "exec ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)""
end tell
2
  • The problem appears to be your double quotes. Try do script "exec ruby -e '.... (Use a single quote to encapsulate everything starting with the $)
    – Allan
    Commented Nov 27, 2018 at 9:16
  • Go ahead and write up an answer and I'll upvote you so you can gain some reputation points.
    – Allan
    Commented Nov 27, 2018 at 10:41

2 Answers 2

1

You are having problems with the quoting of commands in a command.

An easy way out is to put the command ina shellscript e.g. name the script ~/bin/install_homebrew and after creating it make it executable

Script is

#!/bin/bash
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)

the call the script from the terminal or from Applescript

tell application "Terminal"
    do script exec "~/bin/install_homebrew "
end tell
0

Try escaping the inner double quotes (") with a backslash (), like so

do script "exec ruby -e \"$(curl -fsSL https://raw.githubuser......install)\""

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .