/etc/motd 略讲

Can I put shell commands in the /etc/motd login banner file?


/etc/motd is only read and not executed, so technically speaking, you cannot put shell commands in there.

However, it's possible to execute a shell script at login time that will have the same result. This is usually achieved by adapting the /etc/profile script that is executed each time a user logs in. A useful practice is to put the command you want to be executed in a script named /etc/motd.sh and call this script from /etc/profile, usually at about the end of it.



你可能感兴趣的:(command,motd,略讲)