diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2021-02-20 00:07:44 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2021-02-20 00:10:20 +0300 |
commit | a469a0ffe98eb48e976a23675fdb02cf7d8b75e3 (patch) | |
tree | c0be6e1d13e6053879e823dc08d6a56530d9ff33 | |
parent | 36a3744b2cfd6beef9459e25d1999d5a8845b5f1 (diff) | |
download | openbmc-a469a0ffe98eb48e976a23675fdb02cf7d8b75e3.tar.xz |
setup: tolerate `which` failures
If this script is sourced in a shell that has something like
`set -e`, then it fails if the column program does not exist
because the `which columm` fails. Make a few changes to
tolerate this and not fail:
- Use $(...) rather than `...`.
- Use `... || true` when appropriate to allow continuance.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I9008778e8aee4747faa4decff74a2fb361a206ed
-rwxr-xr-x | setup | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -21,10 +21,10 @@ if [ -z "$ZSH_NAME" ] && [ "$(basename -- "$0")" = "setup" ]; then fi # Check if 'column' command is present -COLUMN=`which column` +COLUMN=$(which column || true) if [ -z "$COLUMN" ]; then # If it is not, use 'cat' - COLUMN=`which cat` + COLUMN=$(which cat) fi machine() { |