Compatible Support Forums: Need help writing a shell script

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Need help writing a shell script

#1 User is offline   Dapper Dan 

  • Pooh-Bah
  • Group: Moderators
  • Posts: 1703
  • Joined: 27-September 03

Posted 21 January 2004 - 04:07 AM

I'm just now trying to learn how to write shell scripts and would like some help. At our radio station, I needed a script that would copy our QuickBooks file, (running under Win4Lin), to back up to a usb reader writer stick. The script, which is called "QBsave" is:
Code:

#!/bin/bash

cp win/Program\ Files/Intuit/QuickBooks\ Pro/Wzla.QBW /mnt/usbstick/QBsave

When we execute this shell script from the IceWM menu, it does the job, although I'd like for it to do a little more. I would like a small window to come up which asks: "The file, "QBsave" already exists. Do you wish to overwrite it?"
And when you click "yes" the file is overwriten, and when you click "no", it isn't.
Anyone know how to do this? Thanks for any help.
0

#2 User is offline   blueworm 

  • member
  • Group: Members
  • Posts: 169
  • Joined: 02-March 03

Posted 23 January 2004 - 01:45 AM

add the -i option to copy.
Code:
#!/bin/bash

cp -i  win/Program\ Files/Intuit/QuickBooks\ Pro/Wzla.QBW /mnt/usbstick/QBsave

Now write another script.
Code:
xterm -e <Name_Of_First_Script>

Note add both scripts to your $PATH.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users