Is it possible to expand and edit the result of a command substitution $(<cmd>)
in Bash?
Suppose that <cmd>
results in another command that I want to execute. Indeed, $(<cmd>)
will execute that command, but it won't be visible in history
, so I can't go back and edit it.
The only way I've solved this problem is to assign the output of $(<cmd>)
to a variable, cmd=$(<cmd>)
, and then echoing that into the clipboard using pbcopy
on macOS: echo $cmd | pbcopy
.
shell-expand-line