1

I would like to run the following command and pipe stout of both to textedit:

pmset -g; echo; pmset -g assertions | open -f -a TextEdit

This doesn't work, it only executes the latter.

Also, anyway to execute multiple arguments for the same command like:

pmset -g { echo, assertions}

I'm sure this will get voted down for being a basic question. Thanks in advance to any who reply.

njboot
  • 147
  • 1
  • 10

3 Answers3

3

(pmset -g; echo; pmset -g assertions) | open -f -a TextEdit

jbmchuck
  • 46
  • 1
  • In fact, you can remove `-a TextEdit` all together. `open -f` opens TextEdit with the contents of `stdin` – grebneke Jan 18 '14 at 00:19
1

Also, anyway to execute multiple arguments for the same command like:

pmset -g { echo, assertions}

That is entirely up to the program, in this case pmset. Some programs allow you to use a switch multiple times, as in pmset -g echo -g assertions

However, that doesn't seem to be the case with pmset

grebneke
  • 4,414
  • 17
  • 24
  • Thanks for this reply to my second question. I don't have enough reputation to "vote up," but will when I gain it. – njboot Jan 19 '14 at 11:36
1

alternatively you can use curly bracket

{ pmset -g; echo; pmset -g assertions; } | open -f -a TextEdit

(pmset -g; echo; pmset -g assertions) is executing the commands in a subshell
{ pmset -g; echo; pmset -g assertions; } is executing the commands in current shell

ray
  • 4,109
  • 1
  • 17
  • 12