Why do backslashes prevent alias expansion?

后端 未结 3 513
庸人自扰
庸人自扰 2020-12-28 15:53

In the first part of my question I will provide some background info as a service to the community. The second part contains the actual question.

Part I

3条回答
  •  一整个雨季
    2020-12-28 16:16

    \ls only quotes the first character rather than the whole word. It's equivalent to writing 'l's.

    You can verify it like this:

    $ touch \?l
    $ \??
    bash: ?l: command not found
    

    If \?? quoted the whole word it would say ?? not found rather than ?l not found.

    I.e. it has the same effect as:

    $ '?'?
    bash: ?l: command not found
    

    rather than:

    $ '??'
    bash: ??: command not found
    

提交回复
热议问题