Q:

How can I shorten commands related to Rails?

To start my Rails app, I go to /var/www/html/app dir first.
Then I execute rest of two commands.  
1. $ cd /var/www/html/app
2. $ bundle exec rake sunspot:solr:start RAILS_ENV=production
3. $ unicorn_rails -c config/unicorn.rb -E production -D

I want to omit first line. and put it into 2nd, and 3rd command.
Is it possible?

A:

I find the best way to solve this problem is just creating your own shell script. It's pretty easy and useful in many ways.
#!/bin/sh
# file-name: app-start.sh
cd /var/www/html/app
bundle exec rake sunspot:solr:start RAILS_ENV=production
unicorn_rails -c config/unicorn.rb -E production -D

then 
chmod +x app-start.sh
./app-start.sh

