# shellcheck shell=bash install_bin() { name="$1" file="$2" source="$3" flag="$4" if file "$file" | grep -Eqv 'ELF|executable'; then diag "$(red "error: file from $source not an executable")" exit 1 fi if [ "$flag" != "--no-backup" ] && [ -f "/usr/local/bin/$name" ]; then sudo cp "/usr/local/bin/$name" "/usr/local/bin/$name.old" fi sudo install -m 755 "$file" "/usr/local/bin/$name" }