I usually have multiple windows requiring to close before sleeping. (all the contents are saved already)

I attempt to accomplish it in terminal so I can encapsulate commands to some script.

I tried:

$ close -a atom
-bash: close: command not found
$ close -a Opera
-bash: close: command not found

How to solve the problem?

  • Why do the windows need to close? – mmmmmm Nov 16 '17 at 2:02
  • I have no idea what that comment means – mmmmmm Nov 16 '17 at 2:26
  • close them let me comfortable to sleep @Mark – Calculus Nov 16 '17 at 2:31
  • @JoseTronco Still don't understand why you need to use the command line. – JMY1000 Nov 16 '17 at 2:50

Use osascript to call an AppleScript from the command line.

Save the following script or one like it somewhere, then run osacript [path to file]:

tell application "Numbers"
    close every document without saving
end tell
| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .