【发布时间】:2014-02-26 00:53:36
【问题描述】:
我被一个相当愚蠢的 bash 脚本困住了:
CMD="get database" / #embedded,specific platform command
DATA="tree path Uo5 Uu7"
custom_command='grep -i Arte | awk -F '[:]' '{print $2}'
这就是我想做的:
VAR=`$CMD "show data $DATA" | $custom_command` <--not working
VAR=`$CMD "show data $DATA" | grep -i Arte | awk -F '[:]' '{print $2}'` <--working
使用 $custom_command 会中断脚本。如何将 $custom_command 用于 VAR?
我使用 custom_command 来避免一遍又一遍地使用相同的字符串。你能帮忙吗?
【问题讨论】: