PDA

View Full Version : checking for existing files in bash


nandasunu
November 25th, 2005, 02:45 PM
hi, I am trying to write a small shell script in bash and need to be able to check if a given file exists. I am not new to programming, but new to linux. Is there such a function that would return 1/0 if a file name exists for example?

any suggestions would be much appreciated.

kabus
November 25th, 2005, 02:53 PM
Take a look at this :

http://www.tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html

nandasunu
November 25th, 2005, 04:45 PM
Thanks a lot for that!