この迷惑なメッセージを削除する方法: "cgroup2インストールが見つかりません"?

この迷惑なメッセージを削除する方法:

このコマンドを実行します

ss -tulpnoea|grep -i water|grep -v 127
Failed to find cgroup2 mount
Failed to find cgroup2 mount
Failed to find cgroup2 mount
Failed to find cgroup2 mount
Failed to find cgroup2 mount
Failed to find cgroup2 mount
Failed to find cgroup2 mount
Failed to find cgroup2 mount
Failed to find cgroup2 mount
Failed to find cgroup2 mount
.....

2> / dev / nullを試しました...

 ss -tulpnoea|grep -i water|grep -v 127 2> /dev/null
    Failed to find cgroup2 mount
    Failed to find cgroup2 mount
    Failed to find cgroup2 mount
    Failed to find cgroup2 mount
    Failed to find cgroup2 mount
    Failed to find cgroup2 mount
    Failed to find cgroup2 mount
    Failed to find cgroup2 mount
    Failed to find cgroup2 mount
    Failed to find cgroup2 mount
    .....

cgroup2マウントに関する迷惑なメッセージを避けるには?ディストリビューションはSlackware 15.0です。

ベストアンサー1

リダイレクトがパイプラインの無効な場所にあります。おそらくエラーはssコマンドで発生するため、エラー出力を非表示にする必要があります。あるいは、コマンドの出力とリダイレクトを完全にグループ化することもできます。

エラーを抑制するためのいくつかの回避策は次のとおりです。

メッセージを生成したコマンドの標準エラーをリダイレクトします。

ss -tulpnoea 2> /dev/null|grep -i water|grep -v 127 

サブシェルでコマンドを実行し、サブシェルの標準エラーをリダイレクトします。

(ss -tulpnoea|grep -i water|grep -v 127) 2> /dev/null

コマンドをグループ化し、グループの標準エラーをリダイレクトします。

{ ss -tulpnoea|grep -i water|grep -v 127 ; } 2> /dev/null

または、他のエラーではなく、そのエラーを特に抑制したい場合(シェルサポートによって異なります)

ss -tulpnoea 2> >(grep -Fxv 'Failed to find cgroup2 mount' >&2)|grep -i water|grep -v 127) 
(ss -tulpnoea|grep -i water|grep -v 127) 2> >(grep -Fxv 'Failed to find cgroup2 mount' >&2)
{ ss -tulpnoea|grep -i water|grep -v 127 ; } 2> >(grep -Fxv 'Failed to find cgroup2 mount' >&2)

おすすめ記事