Re: User menu: pattern matching acts not as expected
Eugen Fabian Karban via mc <[email protected]> Wed, 12 Mar 2025 14:38:32 +0000
| Newsgroups | gmane.comp.gnome.apps.mc.general |
|---|---|
| Message-ID | <trinity-9c35011f-a05f-4ccc-b783-cdde894eec5e-1741790312513@trinity-msg-rest-webde-webde-live-58ddd584d4-22bj9> |
--===============1233194184454795754== Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">Tryin= g to explain better what i've tested:</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">I hav= e created 4 files with:</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span= style=3D"font-family: 'courier new', courier;">$ touch 'file_without_space= s'</span><br><span style=3D"font-family: 'courier new', courier;">$ touch '= file with spaces'</span><br><span style=3D"font-family: 'courier new', cour= ier;">$ touch 'file_without_spaces_utf8_local_chars_=C3=A4_=C3=BC_=C3=B6_= =C3=9F_'</span><br><span style=3D"font-family: 'courier new', courier;">$ t= ouch 'file_without_spaces_utf8_nonlocal_chars_=C3=A0_=C3=A1_'</span></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">On my= system everything looks like it should=2E<br><span style=3D"font-family: '= courier new', courier;">$ ls -n</span><br><span style=3D"font-family: 'cour= ier new', courier;">insgesamt 0</span><br><span style=3D"font-family: 'cour= ier new', courier;">-rw-r--r-- 1 12073 40000 0 M=C3=A4r 12 13:39 file= _without_spaces</span><br><span style=3D"font-family: 'courier new', courie= r;">-rw-r--r-- 1 12073 40000 0 M=C3=A4r 12 13:40 file_without_spaces_= utf8_local_chars_=C3=A4_=C3=BC_=C3=B6_=C3=9F_</span><br><span style=3D"font= -family: 'courier new', courier;">-rw-r--r-- 1 12073 40000 0 M=C3=A4r 12 13= :40 file_without_spaces_utf8_nonlocal_chars_=C3=A0_=C3=A1_</span><br>= <span style=3D"font-family: 'courier new', courier;">-rw-r--r-- 1 12073 400= 00 0 M=C3=A4r 12 15:08 'file with spaces'</span></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">They = also look good in mc=2E </div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">Then = in mc I'm going with the cursor over the file and press F2 (user menu) (Deb= ug is on for the user menu: see the '?' in the line '+? f [[:space:]] &= t r')<br>mc will show a debug for file name: 'f' matching pattern: '[[:spa= ce:]]'=2E</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">These= are my lines "filename=3D", "debug=3D" and "result=3D"<br>Notice: in= geman "Falsch" means "false" and "Wahr" means "true"</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">The p= roblem ist by the file 'file_without_spaces_utf8_nonlocal_chars_=C3=A0_=C3= =A1_' hier the debug result ist true (?) and it should be false=2E<br>case = 4:<br>filename=3D'file_without_spaces_utf8_nonlocal_chars_=C3=A0_=C3=A1_'<b= r>debug=3DWahr: f [[:space:]]<br>result=3Dworks NOT as expected (WRONG)</di= v> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"> = ;</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">The s= ame test with a bash variable:<br>creating a variable var<br><span style=3D= "font-family: 'courier new', courier;">$ var=3D'file_without_spaces_utf8_no= nlocal_chars_=C3=A0_=C3=A1_'</span></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">test = if var matches pattern [[:space:]]</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span= style=3D"font-family: 'courier new', courier;">$ [[ $var =3D~ [[:space:]] = ]] && echo "var has spaces" || echo "var has NO spaces"</span><br><= span style=3D"font-family: 'courier new', courier;">var has NO spaces</span= ></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">it wo= rks=2E <br>Fact is: in bash on my system pattern matching [[:space:]] = works well, in mc not=2E</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><br>A= nyway i will make a test with a recent version of mc an report=2E</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"> = ;</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">Greet= s</div> </div> --===============1233194184454795754== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- mc mailing list [email protected] https://lists.midnight-commander.org/mailman/listinfo/mc --===============1233194184454795754==--