4 grep -xq '[0-9]\+' <<<"$1"
8 local file tail eq eqt m
13 if [ "${eq%% *}" -eq "$2" ] 2>/dev/null; then
14 if [[ "$eq" == *\ * ]]; then
20 elif [ "${eq:0:${#2}}" = "$2" ]; then
22 if [ "${eqt:0:1}" = " " -o -z "$eqt" ]; then
28 if [ "$eqt" = "$3" -o "$eqt" = "($3)" ]; then
40 while [ "${1:0:1}" = - ]; do
45 echo "usage: planime [-ht] [-s PAR VAL] [NAME-QUAL] [EP|.] [TYPE-QUAL]" >&2
49 cmdline=("${cmdline[@]}" -ao oss:/dev/dsp1)
60 base="$(basename "$(pwd)")"
66 if [ -r curser ]; then
67 base="$base $(<curser)"
69 elif [ $# -eq 1 ]; then
73 if findfile "$base - " "$1" >/dev/null; then
80 elif [ $# -eq 2 ]; then
81 if findfile "$base - " "$1" "$2" >/dev/null; then
85 if [ "$1" = . -a -r curser ]; then
86 base="$base $(<curser)"
93 if [ "$1" = . -a -r curser ]; then
94 base="$base $(<curser)"
101 if [ "$ep" = . ]; then nextep=y; fi
102 if [ "$nextep" = y -a -r nextep ]; then
104 if ! isnum "$ep"; then
105 echo "planime: nextep is non-numeric" >&2
109 if [ -z "$file" ]; then
110 file="$(findfile "$base - " "$ep" "$tqual")"
113 if [ -z "$file" -o ! -r "$file" ]; then
114 echo "planime: no matching file found" >&2
118 case "${file##*.}" in
120 defopts=(-aid 1 -sid 0)
123 defopts=(-slang eng -alang jpn)
127 ifile=".${file}.info"
129 if [ -n "$savepar" ]; then
130 if [ -r "$ifile" ]; then
131 egrep -v "^${savepar} " "$ifile" >"$ifile.new"
132 mv -f "$ifile.new" "$ifile"
134 echo "$savepar $saveval" >>"$ifile"
140 if [ -r "$ifile" ]; then
143 while read par arg; do
144 if [ "$par" = delay ]; then
145 cmdline=("${cmdline[@]}" -delay "$arg")
146 elif [ "$par" = aspect ]; then
147 cmdline=("${cmdline[@]}" -aspect "$arg")
153 cmdline=("${cmdline[@]}" "${defopts[@]}")
156 if [ "`hostname`" = pc6 ]; then chwp=y; fi
158 if [ "$chwp" = y ]; then (sleep 2; randomwp) & fi
159 "${cmdline[@]}" "$file"
161 if [ "$nextep" = y ]; then
162 echo "0. Save and continue (or Space)"
163 echo "1. Continue without saving"
164 echo "2. Save and exit (or Enter)"
165 echo "3. Exit without saving (or any key)"
181 if [ "$save" = y ]; then
185 if [ "$cont" = y ]; then
186 exec "${origargs[@]}"