image
image

Go Back   macosx.com > Mac Help Forums > HOWTO & FAQs

Reply
 
LinkBack Thread Tools
  #1  
Old May 5th, 2003, 12:43 AM
Registered User
 
Join Date: Dec 2001
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
alligatorTim is on a distinguished road
HOW TO: start your default web browser with one unix command

kind of silly i know, but i edit html in my term windows and i hate using a mouse to test in a browser.

short version:
--------------------------
1. make an html page. (page.html)
2. write an executable shell script somewhere in your $PATH with the line "Open /path/to/page.html;".
--------------------------

long version:
--------------------------
fisrt create a nice little html page. mine looks like this..

PHP Code:
<html>
<
title>alligatorTim</title>
<
body bgcolor="#ffffff">
hello alligator.
</
body>
</
html
but you can do anything you want within the boundrys of client side web content. once you create your html page name it "mypage.html" and put it in your home directory. (/Users/yourname)

now open a terminal and type "cd /usr/bin" then, using your favorite unix text editor create a file with the following line:

Open /Users/yourname/mypage.html;

you will have to run the editor as the super user (using sudo) because root owns /usr/bin. so for example "sudo pico zong". name the file something catchy and easy to type because the name of this file is gonna be the command you type to launch your browser. i used "zong".

finally. once you've saved your new file and exited your editor. you need to type "sudo chmod a+x zong".

now when you type "zong" at the command prompt it will launch your page in your default browser.
--------------------------
Reply With Quote
  #2  
Old May 5th, 2003, 02:34 AM
Darkshadow's Avatar
wandering shadow
 
Join Date: Jul 2001
Location: DE, USA
Posts: 1,532
Thanks: 0
Thanked 0 Times in 0 Posts
Darkshadow is on a distinguished road
Umm...why would you write a shell script to do that? You could just type open /Users/yourname/mypage.html and it would work fine. Or are you just going for a one word command? I guess that's helpful....
__________________
I am but a lonely shadow,
Doomed forever to roam and wander.
But if you allow me to pause before I must go,
I'll spin you tales of mystery and wonder.


Site: Night Productions
Reply With Quote
  #3  
Old May 5th, 2003, 11:18 PM
Registered User
 
Join Date: Mar 2003
Location: Brisbane, QLD, Australia
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
bbos is on a distinguished road
Or you could setup your site (/Users/<you>/Site == http://localhost/~you. Create and index.html page and at its simplist create a list of all the pages you are createing with anchor links to them. Then work on your html files that are in ..../Sites/<optional subdirs>.

This way you can use the html pages as if they are on a Web server (which they now are), rather than the reduced functionality you have when opening pages on the normal file system. For example, if you have php setup, you html, I mean php pages can contain PHP code and will work correctly, but won't if handled outside of the webserver. You also have access to the cgi-bin thru the Web Server.

I hope that helps!

Cheers,

Brooke
Reply With Quote
  #4  
Old May 9th, 2003, 10:31 PM
Registered User
 
Join Date: Feb 2003
Location: Fargo, ND
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Brian G. is on a distinguished road
And NEVER, NEVER (did I say NEVER) put your scripts in /usr/bin.

Use ~/bin or /usr/local/bin for your stuff. I really makes it much easier to backup and restore if you know what is yours and what is owned by the system.

Brian G.
Reply With Quote
Reply

Bookmarks

Thread Tools

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 Off
Pingbacks are Off
Refbacks are Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Thank God the Witch Is Dead Veljo Mac OS X System & Mac Software 2 June 27th, 2003 06:51 PM
Browser Standards: Safari Web Browser PXL Transmitter Opinions, & Open Letters 2 January 15th, 2003 07:31 AM
Lock Omniweb as the default browser? AlanBDahl Mac OS X System & Mac Software 5 January 22nd, 2002 12:57 PM
UNIX related things... (tr, cut, awk, and permissions) simX Apple News, Rumors & Discussion 5 December 19th, 2001 03:33 AM
UNIX command line: where can I learn??? Nachohat Mac OS X System & Mac Software 6 July 25th, 2001 12:42 AM


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


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC1
Copyright 2000-2010 DigitalCrowd, Inc.