zsh-users
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-users@sunsite.dk
Cc: Hannu Koivisto <azure@iki.fi>
Subject: Re: How to create unnamed temporary arrays?
Date: Mon, 19 Feb 2001 10:55:51 +0100 (MET)	[thread overview]
Message-ID: <200102190955.KAA10015@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Hannu Koivisto's message of 19 Feb 2001 11:52:40 +0200


Hannu Koivisto wrote:

> Greetings,
> 
> I'm currently using something like this to list the base names of
> files in /usr/local/etc/packages/ directory, each name on its own
> line:
> 
> echo ${(F)$(echo /usr/local/etc/packages/*(.:t:r))}
> 
> This has the obvious problem that it doesn't work if filenames have
> spaces in them.  I just couldn't figure out any way to do something
> corresponding to:
> 
> kala=(/usr/local/etc/packages/*(.:t:r))
> echo ${(F)kala}
> 
> without creating that temporary array variable.  Not that this
> really matters in this case, but I've faced situations earlier
> where avoiding the temporary name might have been more convenient
> and now I finally have a simple enough example to demonstrate it.
> 
> So, is there a way?  I'm using zsh versions 3.1.9-dev-6 and
> 3.1.9-dev-8 from Debian GNU/Linux testing/unstable and stable,
> respectively.

If I got that right and you really only want those filenames one per
line, you can just use:

  print -l /usr/local/etc/packages/*(.:t:r)

(the -l option to print makes it print the argument one per line).

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


         reply	other threads:[~2001-02-19  9:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-19  9:52 Hannu Koivisto
2001-02-19  9:55 ` Sven Wischnowsky [this message]
2001-02-20 18:02   ` Hannu Koivisto
2001-02-20 18:38     ` Andrej Borsenkow
2001-02-26  6:38       ` Bart Schaefer
2001-02-21  6:56     ` Thomas Köhler
2001-02-22  6:01       ` Andrej Borsenkow
2001-02-23 10:48         ` Stop _path_files from searching / Christoph Lange
2001-02-23 12:15           ` Andrej Borsenkow
2001-02-26  8:26             ` Christoph Lange

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200102190955.KAA10015@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=azure@iki.fi \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).