Various enhancements to download-build-gdb.sh
I ran shellcheck [1] on the script and it found various minor things to
improve.
- Use $(...) instead of `...` to run commands in a subshell.
- Wrap all variables in quotes, in case there are spaces.
At the same time, I noticed a few other things:
- Use "#!/usr/bin/env bash" instead of "#!/bin/bash", in case the user
uses a bash not at /bin/bash.
- Use "set -o errexit" instead of "set -e" for better readability.
- Use "set -o nounset" to generate errors if trying to read unset
variables.
- Pass CXXFLAGS in addition to CFLAGS, since GDB is now in C++.
- Use ${CFLAGS:-} instead of ${CFLAGS}, in case CFLAGS is not set
(because of "set -o nounset").
- Don't check for result of getopt. If it fails, the script ends
immediatly due to errexit.
[1] http://www.shellcheck.net/
Change-Id: If73f3510e46ca80d542d47c29c55b48b8b0bc697
Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
1 file changed