gpt4 book ai didi

macos - 如何在 OS X 上使用默认值和 -data 写入十六进制值?

转载 作者:行者123 更新时间:2023-12-05 05:26:24 24 4
gpt4 key购买 nike

我正在为 my dotfiles 玩一些“默认写入” & 可以找到一种写六边形值的方法。

当我阅读时,我得到这样的结果

$ defaults read com.ragingmenace.MenuMeters CPUSystemColor
<040b7374 7265616d 74797065 6481e803 84014084 8484074e 53436f6c 6f720084 84084e53 4f626a65 63740085 84016301 84046666 6666831b 677c3f00 83d70ea8 3d0186>

所以我尝试了这个命令但没有成功(在检查了 man defaults 之后)

$ defaults write com.ragingmenace.MenuMeters CPUSystemColor -data "<040b7374 7265616d 74797065 6481e803 84014084 8484074e 53436f6c 6f720084 84084e53 4f626a65 63740085 84016301 84046666 66668364 79783f83 1b677c3f 83bf8073 3f0186>"
Command line interface to a user's defaults.
Syntax:

'defaults' [-currentHost | -host <hostname>] followed by one of the following:

read shows all defaults
read <domain> shows defaults for given domain
read <domain> <key> shows defaults for given domain, key

read-type <domain> <key> shows the type for the given domain, key

write <domain> <domain_rep> writes domain (overwrites existing)
write <domain> <key> <value> writes key for domain

rename <domain> <old_key> <new_key> renames old_key to new_key

delete <domain> deletes domain
delete <domain> <key> deletes key in domain

import <domain> <path to plist> writes the plist at path to domain
import <domain> - writes a plist from stdin to domain
export <domain> <path to plist> saves domain as a binary plist to path
export <domain> - writes domain as an xml plist to stdout
domains lists all domains
find <word> lists all entries containing word
help print this help

<domain> is ( <domain_name> | -app <application_name> | -globalDomain )
or a path to a file omitting the '.plist' extension

<value> is one of:
<value_rep>
-string <string_value>
-data <hex_digits>
-int[eger] <integer_value>
-float <floating-point_value>
-bool[ean] (true | false | yes | no)
-date <date_rep>
-array <value1> <value2> ...
-array-add <value1> <value2> ...
-dict <key1> <value1> <key2> <value2> ...
-dict-add <key1> <value1> ...

您可以看到格式似乎无法识别。所以一些变化没有成功

$ defaults write com.ragingmenace.MenuMeters CPUSystemColor -data <040b73747265616d747970656481e803840140848484074e53436f6c6f72008484084e534f626a656374008584016301840466666666836479783f831b677c3f83bf80733f0186>
# same error as the first one

$ defaults write com.ragingmenace.MenuMeters CPUSystemColor -data "<040b73747265616d747970656481e803840140848484074e53436f6c6f72008484084e534f626a656374008584016301840466666666836479783f831b677c3f83bf80733f0186>"
# same error as the first one

$ defaults write com.ragingmenace.MenuMeters CPUSystemColor -data <040b7374 7265616d 74797065 6481e803 84014084 8484074e 53436f6c 6f720084 84084e53 4f626a65 63740085 84016301 84046666 66668364 79783f83 1b677c3f 83bf8073 3f0186>
zsh: parse error near `\n'

$ defaults write com.ragingmenace.MenuMeters CPUSystemColor -data <'040b7374 7265616d 74797065 6481e803 84014084 8484074e 53436f6c 6f720084 84084e53 4f626a65 63740085 84016301 84046666 66668364 79783f83 1b677c3f 83bf8073 3f0186'>
zsh: parse error near `\n'

知道如何让它工作吗?

最佳答案

其实很简单,去掉<就可以了, > & 所有空格。

$ defaults write com.ragingmenace.MenuMeters CPUSystemColor -data "040b73747265616d747970656481e803840140848484074e53436f6c6f72008484084e534f626a656374008584016301840466666666836479783f831b677c3f83bf80733f0186"

您可以通过执行 defaults read 来验证它是否正常工作

$ defaults read com.ragingmenace.MenuMeters CPUSystemColor

<040b7374 7265616d 74797065 6481e803 84014084 8484074e 53436f6c 6f720084 84084e53 4f626a65 63740085 84016301 84046666 6666831b 677c3f00 83d70ea8 3d0186>

关于macos - 如何在 OS X 上使用默认值和 -data 写入十六进制值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26461258/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com