所以我想运行一个需要我输入文件名的脚本。
例如:
/userthatisnotme/bin/移动文件名
所以我想让它更容易记住,所以我可以只键入 move filename
而不是整个路径。
我该怎么做?
最佳答案
在您的 bash_profile(或其他 shell 配置文件脚本)中:
alias my_move="/userthatisnotme/bin/move"
此处 ls 的别名示例:http://github.com/adamv/dotfiles/blob/master/bashrc#L45
“参数”放在别名之后。对于更复杂的情况,您可以创建一个 shell 函数而不是别名。
关于linux - 我可以使用参数创建别名吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4002046/