bash alias with argument and autocompletion

前端 未结 2 1597
青春惊慌失措
青春惊慌失措 2021-02-02 01:30

I have a bunch of scripts in directory that exists on the path, so I can access each wherever I am. Sometime those are very simple util scripts that \"vims\" the file. From tim

2条回答
  •  感动是毒
    2021-02-02 02:20

    For the alias with argument, use function instead of aliases :

    a() { cat `which $1` ;}
    

    Or if you do it on more than one line, skip th semicolon :

    a() {
        cat `which $1`
    }
    

    You can enter it interactively at the shell prompt :

    shell:>a() {
    >cat `which $1`
    >}
    shell:>
    

提交回复
热议问题