Gossamer Forum
Home : General : Internet Technologies :

prompt how to auto accept (yes/n0)

Quote Reply
prompt how to auto accept (yes/n0)
Hi there,

Im writing a simple archive shell script that will simply gzip a file via cron.

Now the file that is being gzip'ed , there is already another copy of it and cron wont run it as there is already a copy of it :(

How can I have the script so that it will auto overwrite the existing file?

Thanks a lot.
Quote Reply
Re: [roi8877] prompt how to auto accept (yes/n0) In reply to
Maybe something like;

if (-e '/path/to/file.txt') { system("rm -f /path/to/file.txt"); }

This assumes you are on a UNIX server.


Andy (mod)
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [roi8877] prompt how to auto accept (yes/n0) In reply to
Running into the same problem myself using gpg.

My temporary solution is to create the file, then email it (or ftp it) to myself and then delete (unlink) the file from the server so the next time the script runs it doesn't ask for any input.

Another way would be to perhaps incorporate today's date into the filename?

Last edited by:

Watts: Jan 19, 2004, 7:30 AM