. f_askfname.sh
. f_askstring.sh
ask_filename "Target File( Blank is Cancel. ): " 1
if [ $? -ne 0 ]; then
echo "*** Canceled."
return 1
fi
FILE1=${_STR}
echo "Target File is \"${FILE1}\""
ask_string "Save File [${FILE1}.up] : " 1
if [ $? -ne 0 ]; then
FILE2="${FILE1}.up"
else
FILE2=${_STR}
fi
echo "Save File is \"${FILE2}\""
sort -o ${FILE2} ${FILE1}
echo "*** Succesful."
unset FILE1 FILE2 _STR
$ cat 1.txt
g
f
e
d
c
b
a
$ ./sortup.sh
Target File( Blank is Cancel. ): 1.txt
Target File is "1.txt"
Save File [1.txt.up] :
Save File is "1.txt.up"
*** Succesful.
$ cat 1.txt.up
a
b
c
d
e
f
g