All Questions
Tagged with history-expansion alias
5
questions
2
votes
1
answer
136
views
How to create alias with a caret^ command?
I have a workflow that first check git diff for specific file and then add it to stage.
git diff ..
^diff^add
I want to give these command a alias but this one doesn't work
alias da="^diff^add&...
1
vote
1
answer
443
views
Setting up aliases for a history expansion pattern
similar to the existing $_ which I learned stands for !-1:$, I would like to create aliases for $__, $___ and so on which refer to the 2nd or 3rd -last command. I have tried adding
alias "$__"='!-2:$'...
4
votes
1
answer
363
views
How can I alias a history expansion in zsh?
I want this to work (it needs extendedglob and histsubstpattern):
alias ri='^(#b)E(?)^E${(l:2::0:)$((match[1]+1))}'
But it doesn't:
$ alias sss='^(#b)E(?)^E${(l:2::0:)$((match[1]+1))}' ...
8
votes
2
answers
1k
views
Why does !! inside an alias not work?
I have this alias set in my system /etc/bashrc file:
alias root="sudo !!"
The intention of this being to run the last used command using sudo of course. When used, it of course appears to substitute ...
63
votes
6
answers
47k
views
How can I `alias sudo !!`?
I'm trying to set an alias for sudo !! in Bash. I tried alias sbb='sudo !!', but it interprets that as a literal !! and prints
sudo: !!: command not found
If I use double quotes, it substitutes ...