How to test if result of a command contains a string in fish shell?
问题 I'm trying to write a brief function to allow me to toggle wemo lights on and off from the command line. Basically I have a command that if i type wemo status will return either Switch: Lights 1 if the lights are on or 0 if they are off. I'd like to write a fish function that essentially lets me toggle them: function lights --description 'Toggle lights' if contains (wemo status) "Lights 1" wemo switch "Lights" off else wemo switch "Lights" on end end Though this doesn't work. I'm thinking