Hack together a quick way to execute using local bindirs (#1)
This commit is contained in:
parent
cbc8bede7a
commit
3b01025006
5 changed files with 56 additions and 2 deletions
25
bin/,
Executable file
25
bin/,
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/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/$@
|
Loading…
Add table
Add a link
Reference in a new issue