The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
bash/awk scripting help (creating OLD new users) Jukai Shell Programming and Scripting 2 10-17-2006 02:36 AM
Creating database in shell, how?! vants UNIX for Advanced & Expert Users 1 10-18-2005 04:00 PM
Creating my first Shell Script plmahan Shell Programming and Scripting 1 11-21-2004 08:32 PM
help on creating shell script master_6ez Shell Programming and Scripting 1 11-21-2004 06:21 PM
Creating new shell in C passat High Level Programming 4 06-06-2001 08:52 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-19-2008
Registered User
 

Join Date: May 2008
Posts: 2
Question Bash shell: Creating Preferences

In OS X I'm currently writing a bash script that requires writing to preference file. I may eventually want to share it with users on other Unix-like OSs and would like to accommodate for that possibility ahead of time.

Most OS X applications save preferences in xml-format plist files. These preferences can be easily created, written and read even from the command line using the Defaults tool. Conventionally the plist files are stored within the user's home folder in ~/Library/Preferences/

Is there a similar preference management mechanism common to GNU/Linux or to BSD? Is there also a standardized location for storing preferences files?
Reply With Quote
Forum Sponsor
  #2  
Old 05-19-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Nope, no such thing. Individual tools have their individual conventions. E.g. Gnome uses a similar mechanism but it's by no means widely supported outside of Gnome.
Reply With Quote
  #3  
Old 05-19-2008
Registered User
 

Join Date: May 2008
Posts: 2
I suspected a much. However that leaves my second question still unanswered: when distributing scripts which require the writing of preferences and caching of data to be used by future iterations– what would would be the standard or even just the polite path to store such files?
Reply With Quote
  #4  
Old 05-19-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Chapter 10 of The Art of Unix Programming: Chapter*10.*Configuration documents the historical legacy in quite some detail. I wish I could point you to something better for future-proofing your solution. Your options are basically either create a dependency on some sort of XML library (if you are writing C code) or a dedicated configuration parsing tool (is this Defaults tool available as a port to other platforms?); or simply fall back to a stone-age flat-file format, with all its quirks and complications.
Reply With Quote
  #5  
Old 05-19-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
On Ubuntu, apt-file search bin/defaults reports that the package gnustep-base-common includes a tool by this name. It sort of goes with something I meant to mention, but forgot; I guess the Mac tool is somehow descended from the NeXT toolbox. (Gnustep / OpenStep are an open-source reimplementation of the NextStep framework. See also GNUstep - Wikipedia, the free encyclopedia)

GNUstep defaults database looks like the Gnustep tool doesn't actually use XML at all, though.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux, ubuntu

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:37 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0