When you run sudo service hadoop-master command, it internally runs a shell script created by us to start the hadoop daemons.
If you want to work with different version of Hadoop-2.7, you may have to update the path of Hadoop-2.7.0 instead of hadoop-2.2 in .bashrc file and also all the configuration files of pig, hive, hbase etc which are dependent on hadoop.