Skip to content

Instantly share code, notes, and snippets.

View cjwelborn's full-sized avatar

Christopher Welborn cjwelborn

View GitHub Profile
@cjwelborn
cjwelborn / select_path_dir.sh
Last active December 18, 2016 19:13
BASH function to make the user select a directory in $PATH.
function select_path {
# BASH function to make the user select a directory in $PATH.
# Outputs the path on success, returns 1 on error, and 2 when
# no path is selected.
# Arguments:
# $1 : Prompt for the select menu.
# Default: "Choose the installation path:"
# Example usage:
# if mypath="$(select_path)"; then
# echo "Success: $mypath"