Bash globbing - autoexpand for a few specific cases?

前端 未结 6 1144
半阙折子戏
半阙折子戏 2020-12-29 13:05

I understand that the wildcard * (by itself) will expand in such a way that it means \"all non-hidden files in the current folder\" with hidden files being thos

6条回答
  •  醉话见心
    2020-12-29 14:00

    To expand on paviums answer and answer the second part of your question, all files except . and .. could be specified like this:

    {.[!.]*,*}
    

    Depending on your exact use case it might be better to set the dotglob shell option, so that bash includes dotfiles in expansions of * by default:

    $ shopt -s dotglob
    $ echo *
    .tst
    

提交回复
热议问题