Solve problem when login message affects batch command.

David gave me an exercise to install MegaCLI at the storage server. I’t easy. But when I added the command to display hard drive status in .bashrc to show the information at every login, I got problem to use sftp, rsync and scp. The command ssh worked well. David told me this was caused by the output information in .bashrc which affected those commands in batch operation. The way to solve this problem is adding the following words above the command to output information in .bashrc. And the information will only show in the interactive login mode.

########################################

[ -z “$PS1” ] && return

echo TEST

########################################

Advertisements

One thought on “Solve problem when login message affects batch command.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s