title: Is there a way to make multiple files open in separate windows with a bash command?
body: <p>I want to make a simple bash script that will open up 4 different text editor windows in 4 separate desktop spaces on my Mac.</p>
  
  <p>The closest solution I have is to transition the desktop by triggering an apple script between each atom call (atom is the text editor I'm using.) Right now it looks like this</p>
  
  <pre><code>prepare() {
    osascript -e "tell application \"System Events\" to key code 18 using command down"
    atom spec
    osascript -e "tell application \"System Events\" to key code 19 using command down"
    atom db
    osascript -e "tell application \"System Events\" to key code 20 using command down"
    atom app
    osascript -e "tell application \"System Events\" to key code 21 using command down"
    atom app/assets
  }
  </code></pre>
  
  <p>The apple script triggers a keyboard click (Command 1, command 2, etc) which I have set up in settings to open a specific desktop space.</p>
  
  <p>The problem is that atom opens in whichever desktop is open when it finishes loading, not when it starts. So each atom window opens in a random space based on how long it takes to load and which line of the bash command was just executed.</p>
  
  <p>How can I get the functionality I need? Open to solutions that are totally different from the way I have it set up. I just need something to open 4 seperate atom windows in 4 different desktop spaces. Don't care how it's done.</p>