From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15176 invoked by alias); 21 Apr 2016 22:14:30 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21472 Received: (qmail 11970 invoked from network); 21 Apr 2016 22:14:28 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: zsh-users@zsh.org To: zsh-users@zsh.org From: Emanuel Berg Subject: Re: virtual files? Date: Fri, 22 Apr 2016 00:14:07 +0200 Message-ID: <878u061ufk.fsf@student.uu.se> References: <8760vdrt5y.fsf@student.uu.se> <1302351461115632@web4o.yandex.ru> <87zispqb9m.fsf@student.uu.se> <160419210337.ZM11236@torch.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c-9ce1e655.08-680-7570702.cust.bredbandsbolaget.se User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Mail-Copies-To: never Cancel-Lock: sha1:Q5z2xP2nNYpIr2JXhbYeXMod6QA= Bart Schaefer writes: > The problem is that implementing something like this > in the shell is fairly useless, because none of the > other tools that the shell might invoke would know > what to do with it. This is why you need something > operating-system-level like FUSE (as Nikolay > mentioned), which can make the virtual object "look > like" an ordinary file or descriptor to anything > using the ordinary libraries/interfaces. That sure is the international superstar hitman approach but it appears to be overkill (ha) not only for this example but also for whatever else I've done and am doing at the zsh and CLI tool level. Also there is some virtue in having the software which you use the most at some level of isolation from the OS (or the OS below I should say). It is a good feeling, and an efficient method, to just be able to bring over your Emacs and zsh gear from one system to another and virtually have the same user experience, all but instantly. And I have actually succeeded doing that! Sometimes... > If all you're wanting is to capture output in > a variable, you can use the "read" command (or use > "sysread" from zsh/system). Zsh arranges for "read" > at the tail of a pipe to execute in the current > shell (unlike most other shells that put the pipe > tail in a subshell) so > > wget -q $link -O - | read -d '' result > > loads the output of wget directly into $result. ... :O I can't believe I missed this the first time I read this message! But if I hadn't, I wouldn't have learned about the () { } =() thing so I suppose it was my ancestors having my back, as always. "If all you're wanting"...? :) But yes, this is exactly what I want! read-test () { local url=http://data.bls.gov/cgi-bin/cpicalc.pl local result wget -q $url -O - | read -d '' result echo $result } (I suppose the "delimiter" is EOF if set to nothing.) Now I'll dig deep into all my shell programming and see if I can prune some unnecessary creation and removal of filesystem files. Delightful! -- underground experts united .... http://user.it.uu.se/~embe8573 Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic - so far: 26 Blogomatic articles -