Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: question mark in filename.
- X-seq: zsh-users 26363
- From: Lawrence Velázquez <vq@xxxxxxxxx>
- To: Ray Andrews <rayandrews@xxxxxxxxxxx>
- Cc: zsh-users@xxxxxxx
- Subject: Re: question mark in filename.
- Date: Sun, 10 Jan 2021 00:39:06 -0500
- Archived-at: <https://zsh.org/users/26363>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-users/2021-01/35560453-83EC-4284-A7B0-395923BF2DF1%40larryv.me>
- In-reply-to: <d720a4ef-d2b6-51b4-d6a6-98b583338621@eastlink.ca>
- List-id: <zsh-users.zsh.org>
- References: <d720a4ef-d2b6-51b4-d6a6-98b583338621@eastlink.ca>
> On Jan 9, 2021, at 11:49 PM, Ray Andrews <rayandrews@xxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author