This is the code I'm using to check the current git branch,
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
I want to run the following code conditionally if the branch is master
cd build && aws s3 cp . s3://www.examle.com/ --recursive
How do I do this in bash?
ifstatement. Look them up in your favorite bash language reference(cd build && exec aws s3 ...)-- adding theexecbalances out the performance impact of the subshell created by the parens (by consuming it), while scoping thecdto only change the directory where that oneaws s3command is run.