Sponsored Content
Full Discussion: Defaults read/write question
Top Forums Shell Programming and Scripting Defaults read/write question Post 302907376 by sudo on Friday 27th of June 2014 11:52:14 AM
Old 06-27-2014
Defaults read/write question

OSX 10.9

How does "defaults" know where to look for .plists? To expand:

Code:
defaults read com.apple.finder
is located in ~/Library/Preferences

but,
Code:
defaults read com.apple.mail
is located in ~/Library/Containers/com.apple.mail/Data/Library/Preferences/com.apple.mail.plist

So my question is, what does 'defaults' use to locate the appropriate .plist and is there a way for me to have it output the path for vicariously placed .plists (such as mail)?

Thanks!
 

10 More Discussions You Might Find Interesting

1. Programming

popening for read and write

How can 'popen()' be used for reading and writing to opening pipe? If i try 'popen("prog", "rw")' and then put and get chars - it does not work. What is wrong? (1 Reply)
Discussion started by: szzz
1 Replies

2. Shell Programming and Scripting

Using 'defaults read' and storing the output in a variable

Hi all, I'm creating a script which uses 'defaults read' to retrieve details from an Info.plist like this; defaults read "/Path/Contents/Info" CFBundleShortVersionString This works fine in Terminal and returns the expected values. Is it possible to use this command in a script, and... (0 Replies)
Discussion started by: davewg
0 Replies

3. Shell Programming and Scripting

read and write from a file

I have tried to show the file name whose size is greater than 200 byte in current directory. Please help me. ls -l | tr -s " " " " | cut -f 5,9 -d " " >out.txt #set -a x `cat out.txt` i=0 `cat out.txt` | while do read x echo $x #re=200 j=0 if }" < "200" ] then echo $j j=`expr $j... (2 Replies)
Discussion started by: rinku
2 Replies

4. UNIX for Dummies Questions & Answers

user & group read/write access question

folks; I created a new users on my SUSE box and i need to give this user/group a read write access to one specific folder. here's the details: - I created new user "funny" under group "users". - I need to give this user "funny" a read/write access to another directory that is owned by "root".... (3 Replies)
Discussion started by: Katkota
3 Replies

5. UNIX for Dummies Questions & Answers

Using defaults read to get value from plist

Hi there, I'm trying to retrieve a value from a plist file, which I have done before with no problems, however this plist file looks a little different.... Normally it's like this; <plist version="1.0"> <dict> key>KeyName</key> <string>blah</string> I want the value of KeyName, so... (1 Reply)
Discussion started by: davewg
1 Replies

6. Shell Programming and Scripting

Find all files with group read OR group write OR user write permission

I need to find all the files that have group Read or Write permission or files that have user write permission. This is what I have so far: find . -exec ls -l {} \; | awk '/-...rw..w./ {print $1 " " $3 " " $4 " " $9}' It shows me all files where group read = true, group write = true... (5 Replies)
Discussion started by: shunter63
5 Replies

7. Programming

read/write files

Hi all, I have a problem with some read/write functions. I have a .bin file which contains a lot of structures as follows: struct alumno { char id; char apellido1; char apellido2; char nombre; float nota1p; float nota2p; float notamedia; char photofilename; }; What I have... (3 Replies)
Discussion started by: Attenea
3 Replies

8. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

9. IP Networking

write() / read() syntax

hi am newbie to unix and socket programing I am trying to figuring out syntax for read and write to send data from server to client and client can read it I have to send two integers write(newsockfd,buffer,"%d %d",x,y,0) writing from client where x and y are two integers.. ... (7 Replies)
Discussion started by: karthik1238
7 Replies

10. Shell Programming and Scripting

Read and write in the file

Hello Guys, How all are doing? I have an issue in Unix and want help from all of you I have a file in UNIX which it read by line by line , If at the end of line '0' is written the it should fetch that line into another file and change '0' to '1' and If at the end of line '1' is written then it... (10 Replies)
Discussion started by: adisky123
10 Replies
DEFAULTS(1)						    BSD General Commands Manual 					       DEFAULTS(1)

NAME
defaults -- access the Mac OS X user defaults system SYNOPSIS
defaults [-currentHost | -host hostname] read [domain [key]] defaults [-currentHost | -host hostname] read-type domain key defaults [-currentHost | -host hostname] write domain { 'plist' | key 'value' } defaults [-currentHost | -host hostname] rename domain old_key new_key defaults [-currentHost | -host hostname] delete [domain [key]] defaults [-currentHost | -host hostname] { domains | find word | help } DESCRIPTION
Defaults allows users to read, write, and delete Mac OS X user defaults from a command-line shell. Mac OS X applications and other programs use the defaults system to record user preferences and other information that must be maintained when the applications aren't running (such as default font for new documents, or the position of an Info panel). Much of this information is accessible through an application's Prefer- ences panel, but some of it isn't, such as the position of the Info panel. You can access this information with defaults Note: Since applications do access the defaults system while they're running, you shouldn't modify the defaults of a running application. If you change a default in a domain that belongs to a running application, the application won't see the change and might even overwrite the default. User defaults belong to domains, which typically correspond to individual applications. Each domain has a dictionary of keys and values rep- resenting its defaults; for example, "Default Font" = "Helvetica". Keys are always strings, but values can be complex data structures com- prising arrays, dictionaries, strings, and binary data. These data structures are stored as XML Property Lists. Though all applications, system services, and other programs have their own domains, they also share a domain named NSGlobalDomain. If a default isn't specified in the application's domain, but is specified in NSGlobalDomain, then the application uses the value in that domain. The commands are as follows: read Prints all of the user's defaults, for every domain, to standard output. read domain Prints all of the user's defaults for domain to standard output. read domain key Prints the value for the default of domain identified by key. read-type domain key Prints the plist type for the given domain identified by key. write domain key 'value' Writes value as the value for key in domain. value must be a property list, and must be enclosed in single quotes. For exam- ple: defaults write com.companyname.appname "Default Color" '(255, 0, 0)' sets the value for Default Color to an array containing the strings 255, 0, 0 (the red, green, and blue components). Note that the key is enclosed in quotation marks because it contains a space. write domain 'plist' Overwrites the defaults information in domain with that given as plist. plist must be a property list representation of a dic- tionary, and must be enclosed in single quotes. For example: defaults write com.companyname.appname '{ "Default Color" = (255, 0, 0); "Default Font" = Helvetica; }'; erases any previous defaults for com.companyname.appname and writes the values for the two names into the defaults system. delete domain Removes all default information for domain. delete domain key Removes the default named key from domain. domains Prints the names of all domains in the user's defaults system. find word Searches for word in the domain names, keys, and values of the user's defaults, and prints out a list of matches. help Prints a list of possible command formats. OPTIONS
Specifying domains: domain If no flag is specified, domain is a domain name of the form com.companyname.appname. Example: defaults read com.apple.TextEdit -app application The name of an application may be provided instead of a domain using the -app flag. Example: defaults read -app TextEdit filepath Domains may also be specified as a path to an arbitrary plist file, with or without the '.plist' extension. For example: defaults read ~/Library/Containers/com.apple.TextEdit/Data/Library/Preferences/com.apple.TextEdit.plist normally gives the same result as the two previous examples. In the following example: defaults write ~/Desktop/TestFile foo bar will write the key 'foo' with the value 'bar' into the plist file 'TestFile.plist' that is on the user's desktop. If the file does not exist, it will be created. If it does exist, the key-value pair will be added, overwriting the value of 'foo' if it already existed. WARNING: The defaults command will be changed in an upcoming major release to only operate on preferences domains. General plist manipulation utilities will be folded into a different command-line program. -g | -globalDomain | NSGlobalDomain Specify the global domain. '-g' and '-globalDomain' may be used as synonyms for NSGlobalDomain. Specifying value types for preference keys: If no type flag is provided, defaults will assume the value is a string. For best results, use one of the type flags, listed below. -string Allows the user to specify a string as the value for the given preference key. -data Allows the user to specify a bunch of raw data bytes as the value for the given preference key. The data must be provided in hexidecimal. -int[eger] Allows the user to specify an integer as the value for the given preference key. -float Allows the user to specify a floating point number as the value for the given preference key. -bool[ean] Allows the user to specify a boolean as the value for the given preference key. Value must be TRUE, FALSE, YES, or NO. -date Allows the user to specify a date as the value for the given preference key. -array Allows the user to specify an array as the value for the given preference key: defaults write somedomain preferenceKey -array element1 element2 element3 The specified array overwrites the value of the key if the key was present at the time of the write. If the key was not present, it is created with the new value. -array-add Allows the user to add new elements to the end of an array for a key which has an array as its value. Usage is the same as -array above. If the key was not present, it is created with the specified array as its value. -dict Allows the user to add a dictionary to the defaults database for a domain. Keys and values are specified in order: defaults write somedomain preferenceKey -dict key1 value1 key2 value2 The specified dictionary overwrites the value of the key if the key was present at the time of the write. If the key was not present, it is created with the new value. -dict-add Allows the user to add new key/value pairs to a dictionary for a key which has a dictionary as its value. Usage is the same as -dict above. If the key was not present, it is created with the specified dictionary as its value. Specifying a host for preferences: Operations on the defaults database normally apply to any host the user may log in on, but may be restricted to apply only to a specific host. If no host is provided, preferences operations will apply to any host the user may log in on. -currentHost Restricts preferences operations to the host the user is currently logged in on. -host hostname Restricts preferences operations to hostname. BUGS
Defaults can be structured in very complex ways, making it difficult for the user to enter them with this command. HISTORY
First appeared in NeXTStep. Mac OS X Nov 3, 2003 Mac OS X
All times are GMT -4. The time now is 06:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy