The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 01-14-2008
reborg's Avatar
reborg reborg is offline
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,824
That is not a good way to process files. However the problem is that you used ls -l and assumed to always find 2 fields, on the first line of ls -l you will only have one field.

One better way would be:
Code:
for file in * ; do
    case $file in 
        *.88)
               do something;;
        *.99)
               do something else;;
    esac
done
Reply With Quote