#!/bin/bash build () { dir="$1" i="$2" cd "./$dir" || exit f=$(echo "$dir" | sed 's/\.\///') nimble install -y if [[ $i == "install" ]]; then sudo cp -v "$f" "/usr/local/bin/$f" fi cd ../ } if [[ $2 != "" ]]; then build "$2" "$1" exit fi for dir in ./*; do if [ -d "$dir" ]; then if [[ "$dir" == "./" ]]; then continue fi build "$dir" "$1" fi done