Skip to content

echo x[~a] echos x and xb #115

@borkovic

Description

@borkovic

rc

I was trying to collect all files/dirs with 2 character names starting with a dot (.) in the current directory, except for the parent dir (..).

Skip double dot

The following did not quite work:

; la
./	../	.j	.k	j	j.c
; echo ./.?      # echo 1
./.. ./.j ./.k
; echo ./.[~.]   # echo 2
./. ./.j ./.k
; echo .?      # echo 3
.. .j .k
; echo .[~.]   # echo 4
. .j .k

In echos 2 and 4 ./.. and.. did not appear as expected, but I did not expect to see the current dir (./. and .).

Was my expectation correct?

Dot in the second place is not special

Also tried pattern .[~j]. Single dot is shown here as well.

; echo .[~j]
. .. .k

Dot in the first place is not special either

Dot is not special:

; touch x xa xb
; echo x[~a]
x xb

bash

In bash single dot is not echoed.

$ echo .[!.]
.j .k
$ echo .[^.]
.j .k

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions