What is the use case of noop [:] in bash?

后端 未结 12 945
滥情空心
滥情空心 2020-12-12 13:07

I searched for noop in bash (:), but was not able to find any good information. What is the exact purpose or use case of this operator?

I tried following and it\'s w

12条回答
  •  误落风尘
    2020-12-12 13:32

    Ignore alias arguments

    Some times you want to have an alias that doesn't take any argument. You can do it using ::

    > alias alert_with_args='echo hello there'
    
    > alias alert='echo hello there;:'
    
    > alert_with_args blabla
    hello there blabla
    
    > alert blabla
    hello there
    

提交回复
热议问题