Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Currently this is what I need to type to execute my task
execute 'mytask'
I want an alias so that I need to type
e mytask
This is what I did which is not working
alias e="execute '$1'"
Make your alias: alias e=execute
alias e=execute
As an example, I have ls aliased to l. I can still type l -l and it works as expected.
ls
l
l -l
Any args just get passed through.
Add a comment
Just make it function.
e() { execute "$1"; }
Exposing and hiding quotation marks, is kinda dangerous in bash terms. In case you're willing not to hide the quotation, you can use:
alias e="execute"
And then use e 'mytask'
e 'mytask'
Is it an absolute must to have it as an alias?
If you're using a .bashrc or .bash_profile you could throw a one-line function in there, like so:
e () { execute '$1'; }
[ed] Beat'd by a mile! :P
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.