refdb-backup portability and design
"Markus Hoenicka" <[email protected]>
| Newsgroups | gmane.text.refdb.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi David, I've tested the refdb-backup script. After some minor adjustments it appears to do the right thing. There were two portability issues: - cut does not understand the long options on many platforms. It is better to use something like cut -d ' ' -f 1. - select is a bash feature. Although you use #!/bin/sh at the top, you'll actually run bash on Linux (try ls -al /bin/sh). The BSDs have a real sh which is different from bash. Therefore I have to ask for bash explicitly in the shebang on FreeBSD. If you want to do this, we'll have to use the configure output to fill in the location of bash (/bin/bash on Linux and Cygwin, /usr/local/bin/bash on most BSDs). I do this in a few other scripts so all we need to do this is already in place. The other option is to restrict the script to real sh features. Another, more general problem is that I see a great potential of this script to run backups automatically. I'd like to define a cron job that runs this script once a week or so. For this to work we'd need a way to pass parameters on the command line instead of an interactive interface. Therefore I'd suggest to use getopt or getopts to read the required user input from the command line. getopt is a standalone POSIX utility, could be used from sh, and should be available on all platforms. On the other hand, getopts is a bash builtin and simpler to use. I can handle the getopts/bash stuff if you agree. Let me know what you think. regards, Markus -- Markus Hoenicka [email protected] (Spam-protected email: replace the quadrupeds with "mhoenicka") http://www.mhoenicka.de ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl