Make a Bash alias that takes a parameter?

后端 未结 20 1977
长发绾君心
长发绾君心 2020-11-21 06:53

I used to use CShell (csh), which lets you make an alias that takes a parameter. The notation was something like

alias junk=\"mv \\\\!* ~/.Trash\"

20条回答
  •  滥情空心
    2020-11-21 07:20

    To give specific answer to the Question posed about creating the alias to move the files to Trash folder instead of deleting them:

    alias rm="mv "$1" -t ~/.Trash/"
    

    Offcourse you have to create dir ~/.Trash first.

    Then just give following command:

    $rm 
    $rm 
    

提交回复
热议问题