Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: whence question
- X-seq: zsh-users 22385
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: whence question
- Date: Sat, 14 Jan 2017 20:13:19 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= mesmtp; bh=nICGCSN8kmr/TftVPg8/f2ZjYJg=; b=N4AI0gs0SXkCJr/nrdHa2 eXdn4EX2kIDLPk7fWzSAiee4FLfoNZJoFqN835beLdGXXSozSZGuFrJEmdSn6nNm c5GnZWl/rKxTLVWRnygPbFeQuD1ZlbFvxidynroYv12l1+g/VmgCDmeQegW+Qg4b IoTMnjXaF2X4I3m4OQ/cPU=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= smtpout; bh=nICGCSN8kmr/TftVPg8/f2ZjYJg=; b=P979blHuv2SkVRrlQeEH lNBZJLW98n6cn2fetGalMIZ11rPxBBxokMP+PoBa4caw2zZ0gysb9GjZ1wJfNXJH 6vIcLB4vINIcHnOtCJN/UFMeAfFhAsJUl2jmVvsOFf9oR3HW3i8MlnWC1q9EJhdD 1nk/ng6LvW8IQpBVEvAvNys=
- In-reply-to: <6237271484420924@web15h.yandex.ru>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <652bcc3f-7365-2e52-d39c-8576278606bc@eastlink.ca> <alpine.LRH.2.00.1701132109250.4560@toltec.zanshin.com> <7b890e89-d01b-ab5c-32bf-b75bfa8d945c__41234.9168131643$1484374276$gmane$org@eastlink.ca> <20170114064807.GA31410@fujitsu.shahaf.local2> <20170114174622.GA12641@trex.cs.ovgu.de> <6237271484420924@web15h.yandex.ru>
Nikolay Aleksandrovich Pavlov (ZyX) wrote on Sat, Jan 14, 2017 at 22:08:44 +0300:
> \* E.g. when you issue `vim *.foo` you most likely do not want to
> open `*.foo` file if you happen to spell glob wrong or `tar cf foo.tar
> *.foo` will create empty archive if glob is spelled wrong and it
> received unexistent file as an argument.
Semantically, the glob «*.foo» and the literal filename «'*.foo'» would
be different types, if the shell language were strongly typed. The
former would be a function that returns a list of words and the
latter would be (is) a word.
You could in principle define a pattern matching flavour where the
regexp /αλφα/ matches the plaintext «alfa», and then — let's assume for
the moment that all your filenames are ASCII — the commands
.
% ls αλφα
% ls alfa
.
would very clearly be different: one of them has a glob argument and one
of them has a literal string argument.
Now, the shell language is _not_ strongly typed, but nonetheless, when
people write «*.foo» intending a pattern that expands to one or more
filenames, it usually doesn't make sense to just use the pattern
instead — not any more than it would be logical for
.
% echo αλφα > list-of-important-files.txt
.
to dump the Greek into the .txt file, in the example where all filenames
were ASCII.
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author