"-"ダッシュで始まるファイルを探す

私は次のような状況にあります。

$ ls
0.txt  aaa.txt  a-.txt  a.txt  b.txt  ddd.txt  -hello.txt  libs  -.txt  ,.txt  !.txt  ].txt  \.txt
$ ls [-a]*.txt
ls: opzione non valida -- "e"
Try 'ls --help' for more information.
$ ls [a-]*.txt
ls: opzione non valida -- "e"
Try 'ls --help' for more information.

Dash(-)はいくつかの問題を引き起こします。で始まるファイルを見つける方法は-

ベストアンサー1

表示オプションの終わり--:ls

ls -- -*

または、次のようにして現在のディレクトリのパラメータを明示的に示します。./

ls ./-*

入力に追加のオプションが必要な場合、または前にls置きます。--./

ls -l -- -*
ls -l ./-*

おすすめ記事