Add error handling: exit if cd fails
This commit is contained in:
parent
d6012677ea
commit
8cd66cf690
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ -d "$1" ]; then
|
if [ -d "$1" ]; then
|
||||||
cd "$1"
|
cd "$1" || exit 1
|
||||||
else
|
else
|
||||||
echo "Usage: $0 <datadir>" >&2
|
echo "Usage: $0 <datadir>" >&2
|
||||||
echo "Removes obsolete Bitcoin database files" >&2
|
echo "Removes obsolete Bitcoin database files" >&2
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
if [ $# -gt 1 ]; then
|
if [ $# -gt 1 ]; then
|
||||||
cd "$2"
|
cd "$2" || exit 1
|
||||||
fi
|
fi
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
FILE="$1"
|
FILE="$1"
|
||||||
|
|
Loading…
Reference in New Issue