Make a Bash alias that takes a parameter?

后端 未结 20 2010
长发绾君心
长发绾君心 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

    Respectfully to all those saying you can't insert a parameter in the middle of an alias I just tested it and found that it did work.

    alias mycommand = "python3 "$1" script.py --folderoutput RESULTS/"

    when I then ran mycommand foobar it worked exactly as if I had typed the command out longhand.

提交回复
热议问题