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 and shell scripting languages 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 06:36 AM
Creating database in shell, how?! vants UNIX for Advanced & Expert Users 1 10-18-2005 08:00 PM
Creating my first Shell Script plmahan Shell Programming and Scripting 1 11-21-2004 11:32 PM
help on creating shell script master_6ez Shell Programming and Scripting 1 11-21-2004 09:21 PM
Creating new shell in C passat High Level Programming 4 06-06-2001 12:52 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-19-2008
airsmurf airsmurf is offline
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?
  #2 (permalink)  
Old 05-19-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
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.
  #3 (permalink)  
Old 05-19-2008
airsmurf airsmurf is offline
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?
  #4 (permalink)  
Old 05-20-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
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.
  #5 (permalink)  
Old 05-20-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
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.
Closed Thread

Bookmarks

Tags
linux, ubuntu

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:39 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0