Здесь есть два возможных подхода, в зависимости от ваших требований. Если вы не хотите запрашивать пароль при активации службы, используйте директиву EnvironmentFile
. Изman systemd.exec
:
Similar to Environment= but reads the environment variables from a text file. The text file should contain new-line-separated variable assignments.
Если вы действительно хотите получать подсказки, вы должны использовать одну из директив systemd-ask-password
. Изman systemd-ask-password
:
systemd-ask-password may be used to query a system password or passphrase from the user, using a question message specified on the command line. When run from a TTY it will query a password on the TTY and print it to standard output. When run with no TTY or with --no-tty it will use the system-wide query mechanism, which allows active users to respond via several agents
jq
по умолчанию выводит закодированные строки JSON -.
Если вы хотите необработанную строку message
, используйте -r
или--raw-output
:
jq -r.message file.json
(если file.json
— документ JSON, который вы показываете ). Это расширит вкладки и новые строки в этой конкретной строке.
Разбор JSON в bash никогда не рекомендуется, но....
если можно помассировать линию:
"message": "newline\n\nword\tword\tword",
стать:
X_message="newline\n\nword\tword\tword"
тогда можно:
$ echo -e "$X_message"
newline
word word word