Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Use glob patterns while reading a file
- X-seq: zsh-users 23747
- From: Dominik Ritter <dritter03@xxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Use glob patterns while reading a file
- Date: Thu, 8 Nov 2018 23:53:24 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=yLXyTMyqyOuD/k1fZsZV0mas2qfXJDEFUOELng80jQY=; b=NsZVYWuVVkWkgCNnIWr+p5xlI8SeBZp3gNthNEA47fdV8zoSCPhi4GM7tO046Z3oT2 xegCTKHm6b2Mhu1+f86gyAeQxkEh8AzLdCwHX7RwXrYDtrHjBXJfOsYg8g8pvDC1kKLI /VCWwcX+2wQzh6jPQ62gJE/xizgqRwW4UCW1TrNorSGoDMJegHcaHUNazOdbvtmJDlM4 T0pkNooiTFrF6/C8R3o91A2o5IL8VtXUMzKAnNaljQisNaGuSsmOCi9yTiuUgvlooQsS xuJt6s+AQ1tl7yRQ0NSL023zOxmMm2/1dCeCPkLgHVtkYJdSE4UjuWxs+04haRoQB307 tT3g==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
Hi all!
I want to use read one of two files, regardless if it exists or not. My
first approach is to use the alternative glob syntax, but with no luck:
$(< ./(a|b)(N))
Without the subshell, the glob is expanded first, thus it works:
< ./(a|b)(N)
Is it possible to get this to work in conjunction with a subshell?
The usual workarounds are to expand the glob first, and iterate over the
resulting files, test for existance and finally read the contents. This
seems quite cumbersome to me.
Thanks for your help,
Dominik
Messages sorted by:
Reverse Date,
Date,
Thread,
Author