M BUZZ CRAZE NEWS
// news

Run command after opening terminal window from script using bash

By Emma Martinez

I have a very simple script I use to open Terminal from Xcode in project root folder:

#!/bin/bash
open -a Terminal "`pwd`"

I want to extend it to run pod install command so I've added && to run it.

#!/bin/bash
open -a Terminal "`pwd`" && pod install

It won't run the second command. I've tried with single &, putting pod install into another script and calling but didn't manage do execute. How would I do this ? I'm thinking since Xcode runs the script to open the terminal, the terminal has no idea about the pod install, so maybe if there is a way to pass input parameter to terminal that would need to be ran.

2

1 Answer

( Ive not tried this, just gleened it from the man page)

I expect the problem is the launcher is running the terminal command, and then running the pod command, rather then running the pod command afterwards. I think what you want to do is run the pod command IN the terminal.

Try

#!/bin/bash
open -a Terminal "`pwd`" -e "pod install"

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy