0

In some circumstances, I need to make an official alias for a set of command, which acts just the same as the original software. Like:

alias ipython3="source /Users/zen1/miniconda2/bin/activate py3k; ipython; source /Users/zen1/miniconda2/bin/deactivate;"

But as I was lazy, I'd like to use another alias for alias ipython3, let it be ipy3, I could do it by just copying ipython3's content. But that would be too clumsy.

Is there some magic_func so that alias ipy3=magic_func("ipython3") can get the alias content of ipython3 when using ipy3?


PS: ipython3 should be kept is because it is the official command to trigger ipython for python 3, which can't be installed properly on my computer.

5

Use this:

alias ipy3='ipython3'
  • Wow, this means alias for alias is internally support by bash? Never thought about it. As ipy3 is under ipython3, it will works, right? – Zen Dec 25 '15 at 8:02
  • Yes, it will work. – Cyrus Dec 25 '15 at 10:59
  • 1
    @Zen You can even control that: alias ipy3='"ipython3"' would not try a second level alias replacement; using "ipy3" instead of "ipy3 would avaoid the first level replacement. Furthermore you can use aliases for parameters if the earlier alias value ends with a space: alias ech="echo foo "; alias text="bar baz"; ech text – Hauke Laging Dec 25 '15 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.