#!/bin/bash current_branch=`git branch | grep \* | cut -d ' ' -f2` if [ $? -eq 0 ] then echo 'Success' else echo 'Failed' fi echo $current_branch