如何通过连接两个字符串在 shell 脚本中调用别名?
How can I call an alias name in a shell script by concatenating two string?
我有一个如下所示的别名
alias testalias12569537329="echo it works"
我的问题是:如何通过连接两个字符串在 shell 脚本中调用 testalias12569537329
?
x="testalias"
x+="12569537329" #timestamp
exec $x #command not found
我知道我可以在shell脚本中直接调用testalias12569537329。但我想操纵时间戳。谢谢!
你可以这样做:
$ eval $x
我有一个如下所示的别名
alias testalias12569537329="echo it works"
我的问题是:如何通过连接两个字符串在 shell 脚本中调用 testalias12569537329
?
x="testalias"
x+="12569537329" #timestamp
exec $x #command not found
我知道我可以在shell脚本中直接调用testalias12569537329。但我想操纵时间戳。谢谢!
你可以这样做:
$ eval $x