-
Notifications
You must be signed in to change notification settings - Fork 17
/
runOnShell
executable file
·45 lines (36 loc) · 1.03 KB
/
runOnShell
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
COMMENT='Note: tk_version 8.6.12(or over, from Homebrew repository) can run this app in macOS after Monterey version.\nIn macOS, I recommend to install tcl-tk by "brew install tcl-tk"\n\n'
cwd=$(dirname $0)
echo "run in" $cwd
WISH_PATH=wish
version=0.0
wishes=("$(which -a wish)" "/usr/local/opt/tcl-tk/bin/wish")
for one in ${wishes[@]}
do
if [ -f $one ]
then
cat $cwd/tk_version_1.sh > $cwd/tk_version.sh
echo exec $one '"$0"' '"$@"' >> $cwd/tk_version.sh
cat $cwd/tk_version_2.sh >> $cwd/tk_version.sh
one_version=$($cwd/tk_version.sh 2>&1)
printf "Found tk version:%7s at %s\n" $one_version $one
if [[ "$one_version" > "$version" ]]
then
version=$one_version
WISH_PATH=$one
fi
fi
done
echo "use (newer) version:" $version
echo $COMMENT
inBG=0
if [ $# -eq 1 -a "$1" = "-bg" ]
then
inBG=1
fi
if [ "$inBG" -eq 1 ]
then
$WISH_PATH $cwd/src/LogCatch.tcl --dir $cwd/src &
else
$WISH_PATH $cwd/src/LogCatch.tcl --dir $cwd/src
fi