Testing Files

Before walking on a frozen pond during early winter, don't you test it first? You know, have your little brother go out on it and see whether he falls through. (Kidding!) Likewise, you might want to test files and strings before you march out to the center of the ice and end up falling through.

Sometimes the data to be manipulated is the name of a file. Your script might need to open the file and process the lines in the file. If the file is an executable program or a script, the processing of the file could involve executing it. If it is a directory, you might want to get a listing of the files in the directory. So where does the data manipulation come into the picture?

Before opening a file for reading, you might want to check ...

Get Korn Shell Programming by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.