我可以链条命令多少?
非常快的问题。我汇总了一些别名,以使这些乏味的蓝牙体操在过去几年中迫使我们的喉咙迫使我们的喉咙变得容易得多。我的问题是在以下bash别名中,我是否可以将多个“&”的or链链接在一起,以便我不必在.zshrc文件中制作多个别名?例如,这是我目前拥有的:
alias sonosconnect="bluetoothconnector --connect 54-2a-1b-bf-2c-dc && switchaudiosource -s SonosRoam"
alias sonos="blueutil -p 1 && sonosconnect"
alias bton="blueutil -p 1"
我的最终结果本质上是将这三个别名结合到一个长的别名中,这是通过使用多个AN&&&的实例来实现这一点?
Very quick question. I have put together a few aliases to make these tedious bluetooth gymnastics that Apple has forced down our throats over the past few years a lot easier. My question is in the following bash aliases may I chain multiple "&&'s or &'s" together so that I don't have to make multiple aliases in my .zshrc file? For instance this is what I currently have:
alias sonosconnect="bluetoothconnector --connect 54-2a-1b-bf-2c-dc && switchaudiosource -s SonosRoam"
alias sonos="blueutil -p 1 && sonosconnect"
alias bton="blueutil -p 1"
My end result would essentially be combining these 3 aliases into one long alias, is this possible by using more than one instance of an &&?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您根本不应该使用别名。改用功能。
命令行可以多长时间没有显着限制,但是在很少情况下,别名是一个更好的选择,而许多 函数是更好甚至只有适当选择的情况。
You shouldn't be using aliases at all. Use functions instead.
There's no significant limit on how long the command line can be, but there are very few situations where an alias is a better choice than function, and many cases where a function is the better or even only appropriate choice.