gpt4 book ai didi

linux - 在 linux 中使用 crontab 在每次打开终端时显示一条消息?

转载 作者:太空宇宙 更新时间:2023-11-04 09:22:48 25 4
gpt4 key购买 nike

我想在终端显示消息:

“欢迎!”

当有人打开终端时

最佳答案

要在打开终端(或通过 ssh 登录)时打印消息,您应该使用当天的消息 (/etc/motd)。

您可以使用 cron 在特定时间覆盖此文件,因此用户在登录时将看到当前消息:

00 1 * * * "/bin/echo 'Good morning' > /etc/motd"
00 12 * * * "/bin/echo 'Good afternoon' > /etc/motd"
00 17 * * * "/bin/echo 'Good evening' > /etc/motd"

关于linux - 在 linux 中使用 crontab 在每次打开终端时显示一条消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40050344/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com