给linux环境变量alias传参数,linux – 将参数传递给modulefile中的set-alias

这篇博客介绍了如何使用set-alias命令在用户的环境中设置或删除别名,特别是针对Bourne Shell风格的功能参数。它解释了如何处理包含"$1"和"$*"的字符串,以及如何在某些不支持别名的shell中创建模拟别名的shell函数。当模块文件被卸载时,set-alias会变为unset-alias。
摘要由CSDN通过智能技术生成

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值