Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Go to web pages from a shell UNIX
alias go "osascript -e 'open location \!:1'"

This is a neat script to put in your aliases.mine (.cshrc) file. Whenever you need to go a webpage just type go followed by the website in quotes.

ie:
go "http://www.linville.org"
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[2,899 views]  

Go to web pages from a shell | 4 comments | Create New Account
Click here to return to the 'Go to web pages from a shell' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
dosn't work
Authored by: macubergeek on Oct 18, '01 10:10:30AM

dosn't work



[ Reply to This | # ]
Works fine...
Authored by: robg on Oct 18, '01 12:12:10PM

At least on the two 10.1 machines I tested it on. Are you running 10.1? Which machine? What happens when you try it?

-rob.



[ Reply to This | # ]
Script to make URL entry simpler
Authored by: houchin on Oct 19, '01 01:41:36PM

This capability is very similar to the capabilities Netscape for Solaris gives you. Several years ago I put together a perl script that would:

1) Allow you to define shortcuts for frequently visited sites
2) Let you specify page title's that were found in your bookmarks file
3) give an entire URL.

I've updated that script for Mac OS X and Internet Explorer. Here it's listed below.
Just create a .www file in your home directory that contains pairs of shortcuts, URL's, one shortcut per line. For example, to create the shortcut for Mac OS X Hints, you'd put a line in:

xhints http://www.macosxhints.com/

Here's the script:

#!/usr/bin/perl

$browser = $ENV{BROWSER};
$homeDir = $ENV{HOME};
$keyFileName = "$homeDir/.www";
$bookmarkFileName = "$homeDir/Library/Preferences/Explorer/Favorites.html";

if ($ARGV[0] eq "-u")
{ shift @ARGV;
goto URL;
}
elsif ($ARGV[0] eq "-b")
{ shift @ARGV;
goto BOOKMARK;
}

KEY:
open(keyFile, "<$keyFileName") || goto BOOKMARK;
while (<keyFile>)
{ if (($url) = /^$ARGV[0]\s*(\S*)/i)
{ last;
}
}
:q
tinironcurse[houchin]208: cat wwwpost
#!/usr/bin/perl

$browser = $ENV{BROWSER};
$homeDir = $ENV{HOME};
$keyFileName = "$homeDir/.www";
$bookmarkFileName = "$homeDir/Library/Preferences/Explorer/Favorites.html";

if ($ARGV[0] eq "-u")
{ shift @ARGV;
goto URL;
}
elsif ($ARGV[0] eq "-b")
{ shift @ARGV;
goto BOOKMARK;
}

KEY:
open(keyFile, "<$keyFileName") || goto BOOKMARK;
while (<keyFile>)
{ if (($url) = /^$ARGV[0]\s*(\S*)/i)
{ last;
}
}
close(keyFile);
if ($url)
{ goto FOUND_URL;
}

BOOKMARK:
open(bookmarkFile, "<$bookmarkFileName") || goto URL;
$temp = <bookmarkFile>;
@bookmarks = split(/\r/, $temp);

foreach $bookmark (@bookmarks)
{ if (($url) = ($bookmark =~ /.*A HREF="(\S*)".*>.*$ARGV[0].*<\/A>/i))
{ last;
}
}
close(bookmarkFile);
if ($url)
{ goto FOUND_URL;
}

URL:
$url = $ARGV[0];

FOUND_URL:
# If the url doesn't contain the protocol, add http:// at the beginning
if ($url =~ /.*:\/\//)
{
}
else
{ $url = "http://$url";
}

# If the there's another argument, add it to the end of the URL
if (@ARGV > 1)
{ # If there's a /, ? or = at the end of the url, add the argument
# directly
if (/[\/?=]$/)
{ $url = "$url$ARGV[1]";
}
else
{ $url = "$url/$ARGV[1]";
}
}

system "osascript -e 'open location \"$url\"'";



[ Reply to This | # ]
Ooops... Script to make URL entry simpler
Authored by: houchin on Oct 19, '01 01:45:48PM

Looks like I accidentally copied too much. Just take everything starting at the line AFTER the line that starts "tinironcurse" and put that into a file.

I'm just going to have to start a web site so I can just upload the scripts instead of pasting them in.



[ Reply to This | # ]