joshuto
joshuto copied to clipboard
Command substitutions in shell commands
Question: Is there support for command substitutions in shell commands? If not, consider this a feature request.
I tried
:shell echo $(date)
and
:shell echo \$(date)
but I always only see the literal (escaped?) string
$(date)
instead of the desired
Mon Oct 21 12:51:29 PM CEST 2024
My use case is is to create a keybinding to create a copy of a file like this:
{ keys = ["y", "b"], commands = ["shell cp -r %s %s.$(date +%F-%%H%M%S).bak"] }
There isn't support for this yet, but might be currently possible with a bash script and calling the bash script instead
Or maybe just by calling shell bash -c "cp ...."? Then you would not require an additional script file.... Haven't tried that but I guess it should work.
There isn't support for this yet, but might be currently possible with a bash script and calling the bash script instead
Thank you, that workaround didn't come to mind yet! And yes, it works :ok_hand:
Or maybe just by calling
shell bash -c "cp ...."? Then you would not require an additional script file.... Haven't tried that but I guess it should work.
Thank you, that'd be elegant, but I can't get it to work with the file substitution (%s).