Ideally to be placed in /usr/local/bin/ otherwise path to r.sh file to be adjusted:
r.sh will be looking like:
#!/usr/bin/expect
set echo off
spawn su -
expect Password:
send “rootpassword\r”
expect *
send “clear\r”
expect *
send “cat /usr/local/bin/motd.txt\r”
interact
alias to “r” key to be created by editing “.bashrc” followed by “source .bashrc”:
alias r='/usr/local/bin/r.sh'