This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: Mailing list redirection etiquette?
- From: Fred Kulack <kulack at us dot ibm dot com>
- To: cygwin at cygwin dot com
- Date: Wed, 6 Oct 2004 14:02:21 -0500
- Subject: RE: Mailing list redirection etiquette?
On 10/06/2004 at 01:09:39 PM, cygwin-owner wrote:
but this won't quote the arguments properly -- if you want that, you need
something like
google () {
url="http://www.google.com/search?q=`echo -n $*|perl -mCGI -pe
'$_=CGI::escape($_)'`";
echo "Starting: $url"; cygstart -o "$url" >/dev/null
}
--- end of excerpt ---
Sigh... You can't just put that comment out there like that can you... 8-)
That doesn't get them quite right either. 8-)
> google "oh what the hell"
Starting: http://www.google.com/search?q=oh%20what%20the%20hell
Using $@ and adding double quotes to any strings with spaces before
running them through CGI::escape does one more step nicely.
Note that I prefer somewhat verbose perl code.
google () {
qry=$(perl -mCGI -e 'undef $qry; for ($i=0; $i<=$#ARGV; $i++) { if
($ARGV[$i] =~ m/ /) { $ARGV[$i]="\"$ARGV[$i]\""; } if (defined $qry)
{$qry.=" ";} $qry.=CGI::escape($ARGV[$i]); }; print "$qry\n";' $@)
url="http://www.google.com/search?q=$qry";
echo "Starting: $url"; cygstart -o "$url" >/dev/null
}
> google "oh what the hell" is this
Starting:
http://www.google.com/search?q=%22oh%20what%20the%20hell%22%20is%20this
NQLGGOB... 8-)
"The stuff we call "software" is not like anything that human society
is used to thinking about. Software is something like a machine, and
something like mathematics, and something like language, and
something like thought, and art, and information...
but software is not in fact any of those other things."
Bruce Sterling - The Hacker Crackdown
Fred A. Kulack - IBM eServer iSeries - Enterprise Application Solutions
ERP, Java DB2 access, Jdbc, JTA, etc...
IBM in Rochester, MN (Phone: 507.253.5982 T/L 553-5982)
mailto:kulack/us.ibm.com Personal: mailto:kulack/magnaspeed.net
AIM Home:FKulack AIM Work:FKulackWrk
MSN Work: fakulack/hotmail.com (replace email / with @)
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/