Posted over 6 years ago. Visible to the public.

Bash: How to only do things in interactive shells

When you print something from within your .bashrc file you will run into trouble when copying something onto your machine using scp for example.

This is because the output from your .bashrc interferes with scp. The solution is to decide whether the bash shell is started interactively (you start a terminal on your screen) or not (scp).

if [ ! -z "$PS1" ]; then # This happens in interactive shells only and does not interfere with scp. echo "Learn!" fi

Once an application no longer requires constant development, it needs periodic maintenance for stable and secure operation. makandra offers monthly maintenance contracts that let you focus on your business while we make sure the lights stay on.

Owner of this card:

Thomas Eisenbarth
Last edit:
over 6 years ago
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Thomas Eisenbarth to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more