|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
VeriSign Code Signing Digital Certificates provides assurance to end users. Read about this and more in the free white paper: “How to Digitally Sign Downloadable Code for Secure Content Transfer.” Learn More! |
|
#1
|
|||
|
|||
|
small "IF" statement help.
hi there,
i have a file called "hello". but lets say if this file doesnt exist.. how do i script it that if the file "hello" doesnt exist to creat the file. ??? |
|
#2
|
|||
|
|||
|
Code:
#!/bin/sh
if [ -f "/directory/filename" ]
then
echo "There";
else
echo "Not there";
fi
-f check to see if it is an ordinary file (not a directory) ..or.. -s checks to see if the file exists and is not empty You can create the file with '> /directory/filename' ..or.. 'touch /directory/filename' |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > small "IF" statement help. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|