#!/bin/bash
go build . || exit 1
./gen > expr1.go
gofmt -w expr1.go

#!/bin/bash
set -e
go build gen.go
./gen > expr1.go
gofmt -w expr1.go

Exit on first error in Bash script
Exit on first error in Bash script
