Dear Dave, I think you have a lot of really good ideas about portability. However, my fear is that there are so many scripts out there, and people without your knowledge won't have a place to go.
Would you be willing to write something for the developer guide that has ALL your recommendations on things to avoid - whether deprecated options like this, or GNUisms (whatever they are), that could be put very prominently in the guide? This would probably really help things in the long run, especially for those of us who barely can write a shell script as it is :) Thanks, - kcrisman On Dec 8, 11:24 am, "Dr. David Kirkby" <[email protected]> wrote: > Many scripts have in them something like > > if [ $SAGE64 = "yes" -a $UNAME = "Darwin" ] ; then > some code > fi > > Where the '-a' means 'AND'. > > The use of the '-a' option is deprecated by both by the > 2004http://www.opengroup.org/onlinepubs/009695399/utilities/test.html > > and 2008http://www.opengroup.org/onlinepubs/9699919799/utilities/test.html > > POSIX standards. (Possibly earlier standards too). > > The above should be written as > > if [ $SAGE64 = "yes" ] && [ $UNAME = "Darwin" ] ; then > CFLAGS = "$CFLAGS -m64" > fi > > (Actually, this SAGE64 and Darwin is one bit of code I really dislike, but > that > is only an issue for portability to Solaris, nothing to do with the test.) > > Likewise, the -o option is too, so > > test expr1 -o expr2 > > should be replaced by > > test expr1 || test expr2 > > I'm not suggesting everyone convert all their scripts, but when writing them, > it > would be wise to bear that in mind. The rationale for preferring the && or || > operator is explained in the documents I linked above. > > Dave -- To post to this group, send an email to [email protected] To unsubscribe from this group, send an email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
