question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: is there a way to have an alias execute multiple commands?

See original GitHub issue

Just curious if there is a way to do this. I didn’t see anything in the docs, so …

Let’s say I have a couple of commands defined: a and b. If I want to define an alias to perform both of these command with an alias, how would I do that?

alias create c a;b or something like that (this doesn’t work, btw, or didn’t for me), hence, the question. Is there a way to do this?

Thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tleonhardtcommented, Dec 17, 2020

@legacy-code Good luck with your project. Glad you are enjoying cmd2. I’ll close this now.

0reactions
legacy-codecommented, Dec 17, 2020

@tleonhardt Thanks so much. This has given me some additional thought on what to add to my app.

Currently, the run_script handles what I need. The only down side is it needs to create a file to execute from, and that’s not bad at all, just sort of inconvenient at worst.

Thanks for the thoughts on using runcmds_plus_hooks - I might give that a go as well. It all depends on how much time I have and how much I need it to work! 😃

I think this issue can be closed. Thanks again for the input and ideas.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I define a bash alias as a sequence of multiple ...
I.e say I want one command to change to a particular directory, then run another command. In addition, is there a way to...
Read more >
Create a bash alias for several commands, some requiring ...
Save this answer. Save the file, then run exec bash from the terminal. The first alias is your command, the second alias allows...
Read more >
Using multiple alias in a single command
This is possible in bash: if the last character of an alias definition is a space (or tab), then bash will unalias the...
Read more >
Bash Aliases for Beginners
Aliases allow you to write shorter versions of commands that you use often. This means that you don't have to write the long-form...
Read more >
1 alias 2 commands 1 argument - The UNIX and Linux Forums
1 · Passing an argument using alias to piped command · alias pipe, shell scripts · hagaysp and has been viewed 961 times....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found