Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh-4.04 and w3m browser



On Wed, Aug 28, 2002 at 15:25:00 +0000, Bart Schaefer wrote:
> ---- 8< ---- snip ---- 8< ----
> function urlglobber {
>     local -a args globbed
>     local arg command="$1"
>     shift
>     for arg
>     do
> 	case "${arg}" in
> 	(ftp://(|localhost)/*)
> 	    globbed=( ${~${arg##ftp://(|localhost)}} )
> 	    args[$#args+1]=( "${(M)arg##ftp://(|localhost)}${(@)^globbed}" )
> 	    ;;
> 	((http(|s)|ftp):*) args[$#args+1]="$arg";;
> 	(*) args[$#args+1]=( ${~arg} );;
> 	esac
>     done
>     "$command" "${(@)args}"
> }
> alias globurl='noglob urlglobber'
> alias ncftp='globurl ncftp'
> alias lynx='globurl lynx'
> alias w3m='globurl w3m'
> ---- 8< ---- snip ---- 8< ----

But how to make it work for any command? (and that should work even
when there are pipes and so on.)

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/> - 100%
validated (X)HTML - Acorn Risc PC, Yellow Pig 17, Championnat International
des Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA



Messages sorted by: Reverse Date, Date, Thread, Author