我有文件a:
This
file
does
have
an error
in it
that
needs
to be
fixed.
Run Code Online (Sandbox Code Playgroud)
和一个类似的文件b:
This
file
does
have
no error
in it
that
needs
to be
fixed.
Run Code Online (Sandbox Code Playgroud)
我可以使用以下命令创建统一的差异diff -u a b:
--- a 2018-01-03 14:20:22 +0100
+++ b 2018-01-03 14:20:37 +0100
@@ -2,7 +2,7 @@
file
does
have
-an error
+no error
in it
that
needs
Run Code Online (Sandbox Code Playgroud)
我还可以使用以下命令将上下文减少到两侧的一行diff -u1 a b:
--- a 2018-01-03 14:20:22 +0100
+++ b 2018-01-03 14:20:37 +0100
@@ …Run Code Online (Sandbox Code Playgroud) 我在 中有一个简单的 systemd 服务/etc/systemd/system/logtest.service,它创建一个输出一些文本的 Podman 容器:
[Unit]
Description=Systemd log test
[Service]
Type=oneshot
ExecStart=podman run --rm busybox echo This should get logged.
Run Code Online (Sandbox Code Playgroud)
当我启动服务时,我看到一行文本:
# systemctl start logtest
# journalctl -u logtest --since '1 min ago'
Mar 28 20:55:31 testserver systemd[1]: Starting Systemd log test...
Mar 28 20:55:32 testserver podman[435178]: 2022-03-28 20:55:32.027215747 +0000 UTC m=+0.084992872 image pull busybox
Mar 28 20:55:32 testserver podman[435178]:
Mar 28 20:55:32 testserver podman[435178]: 2022-03-28 20:55:32.27963909 +0000 UTC m=+0.337416181 container create f08d9eb3e843f601873c1b3db721c42175a56b27b9680dbd123781ca3ff7b808 (image=docker.io/library/busybox:latest, name=stupefied_gould)
Mar 28 …Run Code Online (Sandbox Code Playgroud)