-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathproxygen.sh
More file actions
29 lines (26 loc) · 733 Bytes
/
proxygen.sh
File metadata and controls
29 lines (26 loc) · 733 Bytes
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
#!/bin/sh
mkdir -p autogen
generate_proxy() {
PROGRAMNAME=$(basename $1)
FULLPATH=$(which $1)
if [ -z "$FULLPATH" ]; then
>&2 echo Warning: \"$1\" not found \(creating proxy anyway\)
fi
echo @echo off > autogen/$PROGRAMNAME.bat
echo bash.exe -c \"${FULLPATH:-$1} %*\" >> autogen/$PROGRAMNAME.bat
#>&2 echo Created proxy for \"${FULLPATH:-$1}\" in autogen/$PROGRAMNAME.bat
}
if [ $# -eq 0 ]; then
echo Enter program names separated by spaces or newlines - e.g. gcc, "/usr/bin/*"
echo Press CTRL-D when done
while read line
do
for programname in $line; do
generate_proxy "$programname"
done
done
else
for programname in $*; do
generate_proxy "$programname"
done
fi