Shell script to prompt for parameters and start Cloud9 IDE in a different directory and port

I was playing with node.js in linux and wanted to try a js IDE (In Windows i use Notepad++ for web coding (With a lot of snippets)). i read something about Cloud9 some time ago but didn’t pay too much attention thinking it was a cool IDE only avalaible online. I was wrong, you can download it and install it locally so i gave it a try.

You can check the steps to install it here:

Creating a bash script that allows workspace selection and automatically start the default browser

I was looking for some way to start cloud9 in the folder i chose, and launch the default web browser to the Cloud9 local installation.

By following the steps in this forum post i was able to create a shell script that asks for a folder.

(I installed node with sudo so i needed to provide the password. I modified the script to capture it.)

(with the xdg-open command is possible to launch the default web browser.)

The final script (make sure you have zenity installed, it’s required for the dialogs)

#!/bin/bash

PROJECT=$(zenity --file-selection --directory --title 'Select a Project Directory')
PASS=$(zenity --password --title 'sudo password')
if test -d "${PROJECT}";then
  echo ${PASS} | sudo -S $HOME/cloud9/bin/cloud9.sh -w "${PROJECT}" -p 3000 &
  sleep 3
   xdg-open http://localhost:3000
fi
exit

##Some notes

Conclusion

I love linux versatility and learning about the command line. With good IDE’s like Cloud9 that cost zero, there is no excuse to release cool products