【发布时间】:2021-05-09 20:09:42
【问题描述】:
您好,我是新手,正在学习 shell 命令。当我将它作为单行命令尝试时,它可以工作,但是当我将命令和路径存储到两个变量中并调用它时,它不起作用。
google-chrome /home/bashscripts/index.html
输出:chrome 打开 /home/bashscripts/index.html (WORKS)
我想通过变量来实现什么:
A="google-chrome"
B="/home/bashscripts/index.html"
$C= echo $(eval $A) $B **(DOESNOT WORK)**
echo $C
输出:bash 打开 google-chrome 空白新标签,但未打开 html 文件。
【问题讨论】: