我尝试从bash
shell加载包含别名的模块文件.
tutorial page对set-alias命令说了以下内容:
set-alias alias-name alias-string
Sets an alias or function with the name alias-name in the user’s environment to the string alias-string. Arguments can be specified using the Bourne Shell style of function arguments. If the string contains “$1”,then this will become the first argument when the alias is interpreted by the shell. The string “$*” corresponds to all of the arguments given to the alias. The character ‘$’ may be escaped using the ‘’ character.
For some shells,aliases are not possible and the command has no effect. For Bourne shell derivatives,a shell function will be written (if supported) to give the impression of an alias. When a modulefile is unloaded,set-alias becomes unset-alias.
我想使用别名来创建一个命令,让我可以使用一些特定的参数启动给定的软件.任何人都可以请指出下面的语法有什么问题?
set-alias cmd "cmd $1 -cnf=/shared/$2 -ssh -etc"
因为模块脚本是用Tcl编写的,所以需要在别名字符串中引用Tcl元字符.最简单的方法是将别名放在{braces}而不是“double-quotes”中.
set-alias cmd {cmd $1 -cnf=/shared/$2 -ssh -etc}