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


Click here to return to the 'Making it user-friendlier' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Making it user-friendlier
Authored by: Bart VdBroeck on May 05, '01 05:24:18PM

After I read this tip and its replies, I just had to try it out. Here's what I did. I added the following two lines to the ".cshrc" file in your home directory:

alias myip ipconfig getifaddr en0
alias myextip 'wget -q -O myipnum http://tools.lyceum.net/network/showmyip; grep H1 myipnum | cut -f 2 -d < | cut -f 2 -d >; rm -f myipnum'

There are two mistakes in the second line. Seems whatever takes care of formatting these comments takes out the backslash characters. You'll have to add a backslash (the flipped version of this one: "/") before "<" and ">".

Again some explanation. First, if you haven't got a ".cshrc" file in your home directory, you'll have to make one. Since this should be a plain text file, you'll have to instruct TextEdit to make a plain text file when you use it to make this file. You'll find the needed menu item in the menu "Format". I however prefer to do this with pico. So I opened Terminal.app and typed "pico .cshrc" in a terminal window. Then I put (you can enter them with copy and paste) the above lines in the file. Type control-o and then control-x (save file and close file).

Now, about those lines. They'll create aliases i.e. named series of commands, something like macros or scripts.
The first one is called "myip" (you can change the name if you like, but be aware these names are case-sensitive like everything Unix). It simply executes the excellent tip from Boulter. If you're a telephone modem user, replace "en0" with "ppp0". If you're not sure check with "ifconfig -a".
The second one is called "myextip" (same remark as above). It executes a series of commands based on the original tip from our beloved Rob Griffiths ;-) It gets the needed web page, finds the line with the IP number (enclosed with <H1> and <H1> tags), selects the second field delimited by "<", so everything before the <H1> tag, and then selects the second field delimited by ">", so everything after the <H1> tag. The result is written as output, 'cause we don't process it any further. Finally the webpage is deleted without any warnings (the -f option). The "" before "<" and ">" tells the shell those are just characters, not commands (the default way the shell looks at those two).

Making those aliases makes sure you don't have to remember the commands. Since you can chose the names of the aliases, I guess remembering them is a lot easier.



[ Reply to This | # ]
Making it user-friendlier
Authored by: Bart VdBroeck on May 05, '01 05:28:45PM

Okay, so the line

The "" before "<" and ">" tells the shell those are just characters, not commands (the default way the shell looks at those two).

should be something like

The backslash character before "<" and ">" tells the shell those are just characters, not commands (the default way the shell looks at those two).

To enable you're new settings type "source .cshrc" after you've edited the ".cshrc" file.



[ Reply to This | # ]
Making it user-friendlier
Authored by: Bart VdBroeck on May 05, '01 05:38:53PM

Ooh, robh's tip is even better. Replace line two with

alias myextip 'wget -q -O /dev/stdout http://tools.lyceum.net/network/showmyip | grep H1 | sed "s|</*H1>||g" '

No backslashes needed this time :-)

PS Sorry about the double post. Seems OmniWeb and the server soft don't like each other.



[ Reply to This | # ]