如何隐藏显示的终端命令输出 [英] How to hide displaying terminal command output
本文介绍了如何隐藏显示的终端命令输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我运行这个命令时,
sudo htpasswd -b /home/reynolds/.htpasswd admin admin
我在终端中得到输出 Updating password for user admin
但我不想显示该输出.所以我在谷歌搜索了一些并尝试使用以下命令.
I am getting output Updating password for user admin
in terminal but I dont want to display that output. So I searched some in google and try with the following commands.
sudo htpasswd -b /home/reynolds/.htpasswd admin admin 2>&1
sudo htpasswd -b /home/reynolds/.htpasswd admin admin > /dev/null
但我仍然在终端中获得该输出.请帮助避免在运行此命令时显示此类输出.请给我建议,因为我是 shell 脚本的初学者.
But still I am getting that output in terminal.Please help to avoid displaying such output while running this command. Please advice me as I am a very beginner in shell scripting.
谢谢.
推荐答案
> /dev/null
并且正常输出被抑制但仍然显示错误
and normal output is suppressed but errors are still shown
跟随命令
> /dev/null 2>&1
包括错误在内的一切都被抑制
and everything, including errors is supressed
这篇关于如何隐藏显示的终端命令输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文