[Wine] Script to run Wine and save log
Martin Gregorie
martin at gregorie.org
Sat Jun 27 18:40:45 CDT 2009
On Sat, 2009-06-27 at 15:39 -0700, perryh at pluto.rain.com wrote:
> > > All SUS-complaint unixes have a /bin/sh ... It ussualy run
> > > Bourne-scripts, but might support various extensions which
> > > may not work in other shells.
> ...
> > I take your point about non-standard extensions, but the way
> > round that is to stick to the original Bourne shell syntax and
> > not use the extensions.
>
> Which is all well and good, provided one is aware of what
> is and is not an extension. Absent a true Bourne shell for
> testing, extensions may easily turn up in a script that was
> intended to be portable.
Nobody said its easy, but its not hard either. There are ways to get a
decent handle on a portable shell scripting subset:
- stick to the syntax in short get-you-going books like
"Unix in a Nutshell" (O'Reilly) which clearly distinguishes
the syntax used by the UNIX SVR4 Bourn shell from ksh syntax.
At least my copy does.
- compile and install the Heirloom Bourn Shell, available
from SourceForge. It is specifically designed for portable
script testing.
- if you can't use those approaches, simply avoid everything except
basic features. Restricting yourself to the following may be overkill
but should do the job:
- use if..then..fi instead of defaulted assignments and
case...esac constructs
- avoid function declarations - you can always call another script
- use only the most basic for loop: for f in $* do...done
- use expr for all calculation and regex matching, not fancy
assignments
- stick to the simple conditions: -s -z -f -r -eq -ne < > !
- be prepared to recode anything that's even slightly complex
if it gets complaints.
This isn't made easy by the way 'compatibility' is maintained by various
Unices and Linuxes - in Fedora (and probably most current
Linuxes) /bin/sh is a hard link to /bin/bash so installing the Heirloom
Bourn Shell is probably the way to go.
Martin
More information about the wine-users
mailing list