summaryrefslogtreecommitdiff
path: root/util/nmedit
blob: 674579e73cb79f9cb7119d8c5f09eacfb0b84851 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
base=$(basename "$0")
if [[ $0 == */* ]]; then
    self=${0}
else
    self=$(which "$0")
fi
self=$(realpath "${self}")
which -a "${base}" | while read -r fake; do
    real=$(realpath "${fake}")
    if [[ ${real} != ${self} ]]; then
        "${real}" "$@"
        break
    fi
done
declare -a file
while [[ $# -ne 0 ]]; do
    case "$1" in
        (-s) shift;;
        (-o) outp=$2; break;;
        (*) file[${#file[@]}]=$1;;
    esac; shift
done
if [[ -n "${outp}" ]]; then
    ldid -T- "${outp}"
else
    for mach in "${file[@]}"; do
        ldid -T- "${mach}"
    done
fi