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 elif [ $# -eq 1 ]; then
70 if findfile "$base - " "$1" >/dev/null; then
77 elif [ $# -eq 2 ]; then
78 if findfile "$base - " "$1" "$2" >/dev/null; then
90 if [ "$ep" = . ]; then nextep=y; fi
91 if [ "$nextep" = y -a -r nextep ]; then
93 if ! isnum "$ep"; then
94 echo "planime: nextep is non-numeric" >&2
98 if [ -z "$file" ]; then
99 file="$(findfile "$base - " "$ep" "$tqual")"
102 if [ -z "$file" -o ! -r "$file" ]; then
103 echo "planime: no matching file found" >&2
107 case "${file##*.}" in
109 defopts=(-aid 1 -sid 0)
112 defopts=(-slang eng -alang jpn)
116 ifile=".${file}.info"
118 if [ -n "$savepar" ]; then
119 if [ -r "$ifile" ]; then
120 egrep -v "^${savepar} " "$ifile" >"$ifile.new"
121 mv -f "$ifile.new" "$ifile"
123 echo "$savepar $saveval" >>"$ifile"
129 if [ -r "$ifile" ]; then
132 while read par arg; do
133 if [ "$par" = delay ]; then
134 cmdline=("${cmdline[@]}" -delay "$arg")
135 elif [ "$par" = aspect ]; then
136 cmdline=("${cmdline[@]}" -aspect "$arg")
142 cmdline=("${cmdline[@]}" "${defopts[@]}")
145 if [ "`hostname`" = pc6 ]; then chwp=y; fi
147 if [ "$chwp" = y ]; then (sleep 2; randomwp) & fi
148 "${cmdline[@]}" "$file"
150 if [ "$nextep" = y ]; then
151 echo "0. Save and continue (or Space)"
152 echo "1. Continue without saving"
153 echo "2. Save and exit (or Enter)"
154 echo "3. Exit without saving (or any key)"
170 if [ "$save" = y ]; then
174 if [ "$cont" = y ]; then
175 exec "${origargs[@]}"