25 lines
474 B
Bash
Executable file
25 lines
474 B
Bash
Executable file
#!/bin/bash
|
|
|
|
function find-local-bin {
|
|
local readonly prefix=$1; shift
|
|
local bin_dir="$prefix-bin"
|
|
local found_bin_dir=""
|
|
|
|
current_dir=$(pwd)
|
|
found_bin_dir=$current_dir/$bin_dir
|
|
while [ ! -d $found_bin_dir ]; do
|
|
if [[ $current_dir == $HOME ]]; then
|
|
found_bin_dir=$HOME/bin
|
|
break
|
|
fi
|
|
|
|
current_dir=$(realpath "$current_dir/..")
|
|
found_bin_dir=$current_dir/$bin_dir
|
|
done
|
|
|
|
echo $found_bin_dir
|
|
}
|
|
|
|
dir=$(find-local-bin aet)
|
|
|
|
exec $dir/$@
|