![]() |
|
|
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 |
| Check if file exist | gksenthilkumar | Shell Programming and Scripting | 3 | 05-11-2009 08:11 PM |
| Need Script to check file exist and compare | rbknisely | UNIX for Dummies Questions & Answers | 1 | 01-16-2008 01:08 AM |
| trying to use arp command... it doesnt exist | HMSS013 | Red Hat | 4 | 11-14-2006 04:23 PM |
| Have a shell script check for a file to exist before processing another file | heprox | Shell Programming and Scripting | 3 | 11-14-2006 03:26 AM |
| how to check if the file exist or not? | gusla | UNIX for Dummies Questions & Answers | 3 | 03-27-2002 10:56 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Check file and if it doesnt exist , exit script
Hi, Another problem, here is my code Code:
#!/bin/sh dir='/opt/apps/script/CSV' datadir='/opt/apps/script/data' while : ; do ls -1rt $dir/*.csv > /dev/null 2>&1 if [ $? -eq 0 ] ;then cp $datadir/weekly.txt $dir/weekly.csv else exit 0 fi done before it executes the while do, I would like it to check for a file named daily.txt in /opt/apps/script/data/ check /opt/apps/script/data/daily.txt first, if it exists, proceed, else exit code.something like this I guess? Code:
#!/bin/sh dir='/opt/apps/script/CSV' datadir='/opt/apps/script/data' -> Check here first, if found, proceed, else exit while : ; do ls -1rt $dir/*.csv > /dev/null 2>&1 if [ $? -eq 0 ] ;then cp $datadir/weekly.txt $dir/weekly.csv else exit 0 fi done Thanks buddies.Regards
|
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|