Hello,i've appended the below to /etc/bashrc, which is causing an error once i try to rsync using ssh to this specific box.any idea how to prevent bashrc to execute the below to a no login shell ? or any other advice for that matter.
if [ $(id -u) -eq 0 ];then # you are rootecho "###############################################"echo "### You are now working as ROOT. ###"echo "### Pay attention to what you type. ###"echo "###############################################" PS1="\[$(tput setaf 1)\]\u@\h:\w #\[$(tput sgr0)\]"else # nothing to doechoecho " ###########################################################"echo "Welcome $(whoami), here's something to start your day with:"echoecho `sh /etc/lines.sh /etc/quotes.txt`echo " ############################################################"echo PS1="[\u@\h:\w] $"fi
Roland RoLaNd wrote:
Hello, i've appended the below to /etc/bashrc, which is causing an error once i try to rsync using ssh to this specific box. any idea how to prevent bashrc to execute the below to a no login shell ? or any other advice for that matter.
you might try putting your block of code in: if [ -n "$PS1" ] ; then <your code> fi
this way it's only executed in interactive shells.
That belongs in /root/.bashrc. Editing /etc/bashrc is not a good idea because it can get overwritten by an update.
Kai
From: Roland RoLaNd r_o_l_a_n_d@hotmail.com
any idea how to prevent bashrc to execute the below to a no login shell ? or any
other advice for that matter.
Maybe try: if shopt -q login_shell; then ... fi
JD