LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-13-2011, 07:34 AM   #1
swathikumar
LQ Newbie
 
Registered: May 2011
Posts: 9

Rep: Reputation: Disabled
Calling URL from shells cript


Hi,

I have to call URL from shell script.
Eg: www.google.com

How can i call URL from the shell script.

Please any one suggest me.
 
Old 06-13-2011, 07:37 AM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
What about
Code:
YOUR_FAVOURITE_BROWSER http://www.google.com
where you replace YOUR_FAVOURITE_BROWSER with your favorite browser.
 
Old 06-13-2011, 07:55 AM   #3
raj77_in
LQ Newbie
 
Registered: Oct 2008
Posts: 26

Rep: Reputation: 15
what do you mean by calling a URL.. If you mean to say, you want to get the contents then you should use wget or curl to get the file and if you want to open the URL then you can either hard code the browser as TobiSGD suggested or you can use xdg-open
 
Old 06-13-2011, 08:19 AM   #4
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
You can use curl as below

curl "http://www.google.com"

I am not sure what is further idea after call it.
 
Old 06-13-2011, 01:31 PM   #5
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,094

Rep: Reputation: 198Reputation: 198
Assuming that by 'call' you mean 'open in a web browser' then you can do as TobiSGD suggested, or use a variant on that

Code:
$ xdg-open http://your.url.here
or
Code:
$ x-www-browser http://your.url.here
should open the url in the user's default web browser. (Where default is as set via whatever preferences are available for that. E.g. in GNOME there's gnome-default-applications-properties which you can get by typing that at a command prompt or will be available in the Control Centre or Preferences or whatever Linux distro it is that you are using (which you should add to your profile or state in your post) calls them as Preferred Applications.
 
Old 06-14-2011, 06:27 AM   #6
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
This part
Quote:
$ x-www-browser http://your.url.here
does not work an a Slackware 13.37 standard installation. IIRC this is a Debian specific command.
 
Old 06-14-2011, 06:31 AM   #7
papa2ae
LQ Newbie
 
Registered: Jun 2011
Posts: 10

Rep: Reputation: Disabled
Well, you can always use the links browser ... if you want everything from the command line and lack a user interface.

so just add it like this (you have to have links installed ofc)

Code:
#!/bin/bash

links http://domain.com
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cript interrupted at same time every night benroberta Linux - General 7 09-04-2010 09:00 AM
[SOLVED] Can all shells read all environmental variables set by other shells? carlodelmundo Linux - Newbie 2 07-23-2010 02:03 PM
running a cript (two ways) tostay2003 Programming 6 08-13-2008 01:45 AM
Calling Remote Flash Game URL Using CURL stranger_6_7 Linux - General 0 05-13-2008 07:15 AM
calling a url from cron MSEC Linux - Newbie 1 02-12-2006 02:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration