Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh-4.04 and w3m browser
- X-seq: zsh-users 5311
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: Vincent Lefevre <vincent@xxxxxxxxxx>, Zsh users list <zsh-users@xxxxxxxxxx>
- Subject: Re: zsh-4.04 and w3m browser
- Date: Wed, 28 Aug 2002 15:25:00 +0000
- In-reply-to: <20020828130851.GE13666@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20020828121825.GD13666@xxxxxxxxxxxxxx> <18364.1030539052@xxxxxxx> <20020828130851.GE13666@xxxxxxxxxxxxxx>
On Aug 28, 3:08pm, Vincent Lefevre wrote:
} Subject: Re: zsh-4.04 and w3m browser
}
} except that I really don't like nonomatch, so I won't use it (unless
} one can apply nonomatch only to some globterns, e.g. to words starting
} with http: or ftp:).
Minimally tested, but seems to work:
---- 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< ----
Other cases, such as <http://localhost/globbed?unglobbed>, are left as an
excercise for the reader.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author