I have the following bash script. I want it to wait after opening up.
For example, after running ./script 001 homework pico
I want read a key and then pico
to open up and then save to the address. But it does not wait to read a key
#!/bin/sh
link="Grades"
classhome="/afs/class"
if [ $# > 3 || $# < 2 ]
then
echo "Usage: enter-grades <section> <gradefile> <?editor>"
echo " enter new grades for section <section> <?editor>."
echo " e.g. enter-grades 401 quiz5 [pico]"
exit 1
fi
section=$1
grade=$2
editor=$3
if [ -z "$editor" ]
then
editor="cat >";
fi
if [ ! -d "$classhome/$section" ]
then
echo "enter-grade: No such section $section"
exit 1;
fi
cd $classhome/$section
echo "If you need to make any changes, wait until this script is done."
echo "Then use your favorite editor."
for n in *
do
if [ -s $n/$link/$grade ]
then
echo "Grade file $grade for $n already exists!"
cat $n/$link/$grade
else
echo "Please enter $grade grade for $n, press return and then Control-D"
read -n 1 -p "Press any key to continue... "
eval $editor $n/$link/$grade
wait
fi
done