Trying to define this alias in zsh I think the problem is that inside the string, $(...) doesn't work properly
alias ss='sudo $(history -p \!\!)'
The output is the usage of sudo
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS]
....
Trying to define this alias in zsh I think the problem is that inside the string, $(...) doesn't work properly
alias ss='sudo $(history -p \!\!)'
The output is the usage of sudo
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS]
....
For listing the history on zsh according to this doc:
fc -ln <number>
the modifiers:
-n
- removes the line counter
<number>
- starts the history from this number historically (-1 is the last used)
for the purpose of the alias the solution is:
alias ss='sudo $(fc -ln -1)'
Special thanks to @ericnb