MOTD Remover

Mbm329 05:05, March 12, 2012 (UTC)

Ever have a system where the admin is required to post a company MOTD (or privacy notice) and/or copyright notice (comes default on HPUX)? Those things are pretty pesky and take up a lot of screen realestate in your scroll buffer. Here's how to remove them.

Place this function in your .profile (or .bashrc, .bash_profile, etc...) and execute it. os=$(uname -s) remove_notices { if [ -f /etc/copyright ] ;then cr_size=$(cat /etc/copyright | wc -l) else cr_size=0 fi if [ -f /etc/motd ] ;then motd_size=$(cat /etc/motd | wc -l) else motd_size=0 fi tot_size=$((${cr_size}+${motd_size})) blank_lines='' i=0 while [ "${i}" != "${tot_size}" ] ;do if [ "${os}" = 'Linux' ] ;then blank_lines=`echo -e "${blank_lines}\ncuu1"` else blank_lines=`echo "${blank_lines}\ncuu1"` fi   i=$((${i}+1)) done tput -S <<-EOF ${blank_lines} ed EOF } remove_notices

Feel free to place other if conditions for other files like the ones at the top of the function. Your admin may call them something else. You might look at /etc/profile to see what gets called at startup.