![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help needed in using case statement | jisha | Shell Programming and Scripting | 0 | 01-16-2008 04:33 AM |
| more elegant way for conditional statement needed | candyflip2000 | Shell Programming and Scripting | 3 | 05-18-2006 08:52 AM |
| Passing argument from one script to other | lloydnwo | Shell Programming and Scripting | 3 | 10-27-2005 03:06 PM |
| pass argument to a filename | jpprial | UNIX for Dummies Questions & Answers | 1 | 09-03-2001 04:12 PM |
| Passing argument to awk script | AkumaTay | UNIX for Dummies Questions & Answers | 1 | 08-03-2001 12:12 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
help needed with script that gets a filename as argument (with an if/else statement)
Hi, I am trying to create a script just to study BASH scripting, but I have some problems. I need to create a script that gets a filename as an argument. The script should behave as follows: • If the given file name already exists, inform the user and quit. • If the given file name does not exist, create an empty file by that name and inform the user. This is my start: Code:
#!/bin/sh echo "type in a filename:" read $FILENAME if .... else #filename that does not exist is created echo "The filename $FILENAME does not exist, creating empty file $FILENAME" touch $FILENAME |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|