Problem
Use wget or debootstrap without check command available.
Solution
Add function assert_commands to lib for check commands available after installation.
Example:
assert_commands() {
local missing=()
for cmd in "$@"; do
if ! command -v "$cmd" &>/dev/null; then
missing+=("$cmd")
fi
done
if [[ ${#missing[@]} -gt 0 ]]; then
echo "Error: commands not found: ${missing[*]}. Exit..."
exit 1
fi
}
Use example:
apt update &&
> apt install -y wget debootstrap &&
> assert_commands wget debootstrap
Problem
Use
wgetordebootstrapwithout check command available.Solution
Add function
assert_commandstolibfor check commands available after installation.Example:
Use example: