There are any number of ways of writing a shell script that will accomplish this task. Because the user should be prompted for a filename, the read command should be used. To verify that the file exists, the test command should be used (which can be summoned by its [ alias). The r option can be used to verify that it is readable. Last, if the file does not exist, the touch utility can be used to create it with a size of zero. Given those parameters, the following shell script will fulfill this role: #MDG.sh echo "Enter filename:" read filename if [ -r $filename ] then echo "File exists" else touch $filename echo "File created" fi TIP There needs to be a space between filename and the ]; otherwise you will get an error message that line 3 is missing the ]. |