Quiero que un dominio com.apple.keyboard.modifiermapping.1452-628-0
contenga la siguiente matriz:
(
{
HIDKeyboardModifierMappingDst = 2;
HIDKeyboardModifierMappingSrc = 0;
},
{
HIDKeyboardModifierMappingDst = 0;
HIDKeyboardModifierMappingSrc = 2;
},
{
HIDKeyboardModifierMappingDst = 0;
HIDKeyboardModifierMappingSrc = 10;
}
)
Puedo lograrlo eliminando el valor actual y ejecutando tres comandos -array-add
:
defaults -currentHost delete -g com.apple.keyboard.modifiermapping.1452-628-0
defaults -currentHost write -g com.apple.keyboard.modifiermapping.1452-628-0 -array-add '{ HIDKeyboardModifierMappingDst = 2; HIDKeyboardModifierMappingSrc = 0; }'
defaults -currentHost write -g com.apple.keyboard.modifiermapping.1452-628-0 -array-add '{ HIDKeyboardModifierMappingDst = 0; HIDKeyboardModifierMappingSrc = 2; }'
defaults -currentHost write -g com.apple.keyboard.modifiermapping.1452-628-0 -array-add '{ HIDKeyboardModifierMappingDst = 0; HIDKeyboardModifierMappingSrc = 10; }'
defaults -currentHost read -g com.apple.keyboard.modifiermapping.1452-628-0
¿Qué sintaxis puedo usar para definir la matriz en un solo comando?
-
Si ejecuto el siguiente script:
defaults -currentHost delete -g com.apple.keyboard.modifiermapping.1452-628-0 defaults -currentHost write -g com.apple.keyboard.modifiermapping.1452-628-0 -array '( { HIDKeyboardModifierMappingDst = 2; HIDKeyboardModifierMappingSrc = 0; }, { HIDKeyboardModifierMappingDst = 0; HIDKeyboardModifierMappingSrc = 2; }, { HIDKeyboardModifierMappingDst = 0; HIDKeyboardModifierMappingSrc = 10; } )' defaults -currentHost read -g com.apple.keyboard.modifiermapping.1452-628-0
Obtengo una matriz dentro de una matriz:
( ( { HIDKeyboardModifierMappingDst = 2; HIDKeyboardModifierMappingSrc = 0; }, { HIDKeyboardModifierMappingDst = 0; HIDKeyboardModifierMappingSrc = 2; }, { HIDKeyboardModifierMappingDst = 0; HIDKeyboardModifierMappingSrc = 10; } ) )
-
Si lo intento con
-plist
en lugar de-array
, obtengo unUnexpected argument
. -
Si ejecuto el siguiente script:
defaults -currentHost delete -g com.apple.keyboard.modifiermapping.1452-628-0 defaults -currentHost write -g com.apple.keyboard.modifiermapping.1452-628-0 -array ' { HIDKeyboardModifierMappingDst = 2; HIDKeyboardModifierMappingSrc = 0; }, { HIDKeyboardModifierMappingDst = 0; HIDKeyboardModifierMappingSrc = 2; }, { HIDKeyboardModifierMappingDst = 0; HIDKeyboardModifierMappingSrc = 10; }' defaults -currentHost read -g com.apple.keyboard.modifiermapping.1452-628-0
Recibo un error de sintaxis
defaults[22044:679428] Could not parse: ... Try single-quoting it.
Nuevamente, pregunta: ¿qué sintaxis puedo usar para definir la matriz en un solo comando?