On 2022-09-06 19:07, Thorsten Glaser wrote:
> Tim Chase dixit:
> 
> >I usually do this with an alias or shell function to populate the            
> >                                                                             
> >                                                                    
> >GET parameters, like                                                         
> >                                                                             
> >                                                                    
> >
> >  $ goog() { lynx [2]https://google.com/search?q="$1"; ; }                    
> >                                                                             
> >                                                                      
> 
> More escaping needed ???
> 
> # GooGle Search
> ggs() {
>       local _q _IFS
> 
>       _IFS=$IFS
>       IFS=+
>       _q="$*"
>       IFS=$_IFS
>       ${BROWSER:-lynx} 
> "http://www.google.com/search?hl=la&pws=0&num=100&safe=off&q=$_q";
> }
[snip]
> Though some want space (+) to be replaced by %20, and # is still a problem.

I've found that, as long as it's quoted, lynx seems to do the
escaping for me.  When I use my version (with only quoting), running

  goog "lynx browser"

launches lynx with the right URL, where pressing "G" to edit the
URL shows the spaces have been escaped.  But you're right that an
unescaped "#" will be treated as the target rather than part of the
search query.  I've just never used my shell functions to search
for things with "#" in them. :-)

-tkc







Reply via email to