Ask Your Question
1

Is this a fedora bug? *[^11]*

asked 2018-04-04 02:03:29 -0600

GaeTaeng gravatar image

updated 2018-05-31 05:36:06 -0600

FranciscoD_ gravatar image

Fedora 64-Bit

VMware Workstation 14 Player

i'm not have 60p

So i can't upload picture .. :(

i made 20 file , that name { 01, 02, 03, 04, 05, 06, 07 ... 19, 20 }

i typed at fedora

$ ls

Print out

01 03 05 07 09 11 13 15 17 19

02 04 06 08 10 12 14 16 18 20

also

i typed to fedora

$ls *[^11]*

I entered it, hoping for anyword & [not 1 or 1 ] & anyword .

I thought '[^11]' was the same as '?' .

but

is that Print out

01 03 05 07 09 12 14 16 18 20

02 04 06 08 10 13 15 17 19

'11' disappeared.

is this bug?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2018-04-04 05:51:49 -0600

villykruse gravatar image

updated 2018-04-04 05:54:08 -0600

I assume your command was actually

ls *[^11]*

This matches any filename with at least one character not a '1'.

So, the names '1', '11', '111', and so on. will not match, and all other names will match.

edit flag offensive delete link more

Comments

Thank you for your kind reply. i have Low English was weak and I could not understand perfectly

I have thought that things written in [] are linked by the relation of 'or'. Should not it be separated by '^ 1' and '1'?

GaeTaeng gravatar imageGaeTaeng ( 2018-04-08 02:09:25 -0600 )edit

If the character is 1 or if it is 1, then the character will not match this glob: [^11].

If the character is 1 or if it is 1, then the character will match this glob [11].

Specifying the character 1 twice is redundant, and will have the same effect as [^1] and [1] respectively. Or you could specify [^111111111111111111111] with the same result.

If the character is 1 or if it is 2, then the character will not match this glob: [^12].

If the character is 1 or if it is 2, then the character will match this glob [12].

It is unclear what you intend to do.

villykruse gravatar imagevillykruse ( 2018-04-08 08:52:11 -0600 )edit

Thank you very much.

GaeTaeng gravatar imageGaeTaeng ( 2018-04-10 23:33:08 -0600 )edit

I'm understand

GaeTaeng gravatar imageGaeTaeng ( 2018-04-10 23:33:19 -0600 )edit
1

answered 2018-04-04 15:37:15 -0600

ssieb gravatar image

Read the Pattern Matching section of the bash man page. The ^ character inverts the usual usage of the [] pattern. So it matches a single character that isn't in the list. The second 1 in your expression is redundant.

edit flag offensive delete link more

Comments

Thank you for your kind reply. oh if so When [] and ^ are connected, is it denying the entire contents of []?

GaeTaeng gravatar imageGaeTaeng ( 2018-04-08 02:12:07 -0600 )edit

That is correct.

ssieb gravatar imagessieb ( 2018-04-08 15:38:22 -0600 )edit

Oh, I am deeply grateful to you.

GaeTaeng gravatar imageGaeTaeng ( 2018-04-10 23:18:50 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-04-04 02:03:29 -0600

Seen: 81 times

Last updated: Apr 04 '18