Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oh My Zsh multiple commands with one alias

Tags:

I'm using Oh My Zsh, and was wondering if there is a way to create a function or alias to run multiple commands. Just as an example, running an 'update' command will update specific gems, but not all of them.

like image 923
snakesonatoni Avatar asked Oct 08 '13 18:10

snakesonatoni


1 Answers

As you've discovered, you can chain commands in a single alias using ;:

alias update_my_gems="echo foo; echo bar"

Alternatively, you can write a function very easily in your ~/.zshrc file:

update_my_gems() {
    echo foo
    echo bar
}

For readability, I'd personally go for a function for anything that's semi-complex.

like image 62
simont Avatar answered Oct 13 '22 00:10

simont