From: "Lawrence Velázquez" <vq@larryv.me>
To: Ray Andrews <rayandrews@eastlink.ca>
Cc: zsh-users@zsh.org
Subject: Re: question mark in filename.
Date: Sun, 10 Jan 2021 00:39:06 -0500 [thread overview]
Message-ID: <35560453-83EC-4284-A7B0-395923BF2DF1@larryv.me> (raw)
In-Reply-To: <d720a4ef-d2b6-51b4-d6a6-98b583338621@eastlink.ca>
> On Jan 9, 2021, at 11:49 PM, Ray Andrews <rayandrews@eastlink.ca> wrote:
>
> Not that there should ever be such a thing
Nonsense. '?' is valid in Unix filenames and should not be stigmatized.
> but I was curious: I throw strings around mostly successfully but not with the stupid question mark:
>
>
> function test1 ()
> {
> input=( "$@" ) # 'input' is fine: "ls s,7*"
> eval $input # this works fine.
> output=( $(eval ${()input}) )
> print "$output" # ... but 'output' looses the question
> marks.
> }
>
> function test2 ()
> {
> string="ls s,7*" # 'ls' finds: 's,7,big?improvements?in?code'
> test1 $string
> }
>
> $ . test; test2
> s,7,big?improvements?in?code
> s,7,big improvements in code
>
> I've tried various invocations in the parenthesis, I thought '(q)' should work but no luck. I'm know that protecting special characters is possible. 'output' prefers to be separate words, broken on the '?' but the outer parenthesis at least get it all back on one line.
Your example works for me in a clean shell.
% zsh --version
zsh 5.8 (x86_64-apple-darwin18.7.0)
% cat foo.zsh
function test1 ()
{
input=( "$@" )
eval $input
output=( $(eval ${()input}) )
print "$output"
}
function test2 ()
{
string="ls s,7*"
test1 $string
}
touch 's,7,big?improvements?in?code'
test2
rm 's,7,big?improvements?in?code'
% ls
foo.zsh
% zsh -f foo.zsh
s,7,big?improvements?in?code
s,7,big?improvements?in?code
What options do you have set? Aliases? Functions? What are the
contents of your current working directory?
vq
next prev parent reply other threads:[~2021-01-10 5:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-10 4:49 Ray Andrews
2021-01-10 5:39 ` Lawrence Velázquez [this message]
2021-01-10 5:46 ` Ray Andrews
2021-01-10 6:06 ` Lawrence Velázquez
2021-01-10 6:21 ` Ray Andrews
2021-01-10 7:02 ` Roman Perepelitsa
2021-01-10 15:03 ` Ray Andrews
2021-01-10 15:28 ` Roman Perepelitsa
2021-01-10 15:55 ` Ray Andrews
2021-01-10 16:32 ` Roman Perepelitsa
2021-01-10 20:57 ` Ray Andrews
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=35560453-83EC-4284-A7B0-395923BF2DF1@larryv.me \
--to=vq@larryv.me \
--cc=rayandrews@eastlink.ca \
--cc=zsh-users@zsh.org \
/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).