AppleScript issues with Terminal commands

applescriptterminal

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

Best Answer

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