[Linux-Biella] leggiamo un file in shell

LeOS linux@bilug.linux.it
Mon, 03 Feb 2003 14:06:48 +0100


vallinidaniele@libero.it wrote:
> Il Fri, 17 Jan 2003 LeOS  ha scritto:

> LeOS ho perso il file: mi rimandi la parte interessata per cortesia?

e quando mai :)
engioi
----------------------------


file=$1


viewlist ()
{
   clear
   lineparsed=$(head -n $pos $file | tail -n 1)
   echo $lineparsed
}



# --- position of the first file name, after the header of the catalog ---
pos=1

while [ "$action" != x ]

do
   # --- in the catalog file lines change for filename, starting and 
ending position and date ---

   viewlist

   read -n 1 action

   if [ $action = p ] ; then
     if [ $pos -gt 1 ] ; then
       let pos=pos-1
     fi
   fi

   if [ $action = n ] ; then
       let pos=pos+1
   fi


   if [ $action = x ] ; then
     echo "Nothing done..."
     cd $currentdir
     #rm -Rf ~/tutils
     exit
   fi

   if [ $action = q ] ; then
     echo "Nothing done..."
     cd $currentdir
     #rm -Rf ~/tutils
     exit
   fi

done