我准备将最后一个命令存储到变量中.
例如:
#last command:
$> cp myfile /to/somewhere
$> last = #some magical command here
$> echo $last
cp myfile /to/somewhere
Run Code Online (Sandbox Code Playgroud)
我在!!:p命令上尝试了几种方式,它确实让我获得了最后一个命令,但我无法将其存储到变量中.
$> last=`!!:p`
$> echo $last
(empty)
Run Code Online (Sandbox Code Playgroud)
有帮助吗?
| 归档时间: |
|
| 查看次数: |
737 次 |
| 最近记录: |