New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

Open a url in mac with blocking terminal


Post Reply New Thread Subscribe

 
Thread Tools
tarun91

 
Member Since: May 18, 2011
Posts: 2
tarun91 is on a distinguished road

tarun91 is offline
Hi,

I am trying to open a url in Safari through terminal in my MAC machine. I am using following command:

open -a /Applications/Safari.app Google

As soon as hit enter, this url opens in Safari but terminal doesn't block i.e. it comes out.

Then, i tried:
open -a /Applications/Safari.app/Contents/MacOS/Safari Google

same thing happens: As soon as hit enter, this url opens in Safari but terminal doesn't block i.e. it comes out.

Then i tried:
/Applications/Safari.app/Contents/MacOs/Safari Google

in this case, as soon as i hit enter, it blocks the terminal but in browser (Safari) it opens: file:///Users/Administrator/http:/google.com

How i open one url using terminal such that it opens that url properly in Safari and it blocks terminal also until i close the browser (in that case, it should come out).
QUOTE Thanks
tarun91

 
Member Since: May 18, 2011
Posts: 2
tarun91 is on a distinguished road

tarun91 is offline
Hi,

I am trying to open a url in Safari through terminal in my MAC machine. I am using following command:

open -a /Applications/Safari.app Google

As soon as hit enter, this url opens in Safari but terminal doesn't block i.e. it comes out.

Then, i tried:
open -a /Applications/Safari.app/Contents/MacOS/Safari Google

same thing happens: As soon as hit enter, this url opens in Safari but terminal doesn't block i.e. it comes out.

Then i tried:
/Applications/Safari.app/Contents/MacOs/Safari Google

in this case, as soon as i hit enter, it blocks the terminal but in browser (Safari) it opens: file:///Users/Administrator/http:/google.com

How i open one url using terminal such that it opens that url properly in Safari and it blocks terminal also until i close the browser (in that case, it should come out).
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 18,203
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
Merged threads. Please do no crosspost (post message in more than one forum).

Can you clarify what you mean by "terminal doesn't block" and "it comes out"? From what I see, you've pretty much exhausted your options there.

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks
Dysfunction

 
Dysfunction's Avatar
 
Member Since: Mar 17, 2008
Location: Tucson, AZ
Posts: 6,638
Dysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant future
Mac Specs: 2008 and 2011 15" mbps, late 11 iMac, iPhone 4s, and too many ipods and other stuff

Dysfunction is offline
Code:
mikeMbp:~ mike$ open -a /Applications/Safari.app "http://www.google.com"
mikeMbp:~ mike$  echo $?
0
works fine for me. Terminal's still available too, which makes sense. The command's been successfully completed, which is why it returns to a prompt (so it doesn't come out, it's done processing). Why are you looking to hang the stdin is probably a better question at this point.

mike
This machine kills fascists
Got # ? phear the command line!
QUOTE Thanks
EvenStranger

 
EvenStranger's Avatar
 
Member Since: Dec 09, 2010
Location: Virginia
Posts: 845
EvenStranger is just really niceEvenStranger is just really niceEvenStranger is just really niceEvenStranger is just really niceEvenStranger is just really nice
Mac Specs: Currently 13" Late 2010 MBA, 4GB/128GB; Early 2011 13" MBP, dual core i7 2.7ghz, 4gb ram, 500gb hd

EvenStranger is offline
This isn't going to be solved by a simple single line command. Open is doing exactly what it's supposed to - it's a finite command, and once the app is open, it's done and returns the user to the command prompt. The other option, calling the app directly, attempts to point the user to a local file on the computer. Odds are this is going to require some combination of shell and AppleScript to call the proper URL. Maybe that's the clue - create the AppleScript to open the URL, and then call it directly.
QUOTE Thanks

Post Reply New Thread Subscribe


« HELP! Restore iPhoto Library for Time Machine! | Yahoo Mail Compromised-- Need Advice »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Need to know how much RAM your Mac can hold? iLaugh Other Hardware and Peripherals 6 12-13-2009 02:49 PM
Data Partition: Using a FAT32 Partition to exchange data between Mac and Windows XP MartinT Running Windows (or anything else) on your Mac 9 11-12-2009 03:56 AM
Mac Users Get More ISP Choices schweb Apple Rumors and Reports 1 03-06-2003 11:57 AM

All times are GMT -4. The time now is 04:48 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?