summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@yeah.nah.nz>2022-02-02 10:39:51 +1300
committerDavid Phillips <david@yeah.nah.nz>2022-02-02 10:40:16 +1300
commit28b82022eb0a2ee4121d517700906984f8eb0734 (patch)
treef1c656810cd706ae3e5338b7adb8a93764bb657e
parent8d5e29dbcff5399307f30bb0c48f7e2fbb09f364 (diff)
downloaddotfiles-28b82022eb0a2ee4121d517700906984f8eb0734.tar.xz
bashrc: Don't print anything unless interactiveHEADmaster
This fixes broken scp.
-rw-r--r--bashrc55
1 files changed, 12 insertions, 43 deletions
diff --git a/bashrc b/bashrc
index 05e3333..ac8c12f 100644
--- a/bashrc
+++ b/bashrc
@@ -1,50 +1,19 @@
#!/usr/bin/bash
-c_off='\e[0m'
-c_bold='\e[1m'
-c_black='\e[30m'
-c_red='\e[31m'
-c_green='\e[32m'
-c_yellow='\e[33m'
-c_blue='\e[34m'
-c_purple='\e[35m'
-c_cyan='\e[36m'
-c_white='\e[37m'
-
export HISTSIZE=10000
export HISTTIMEFORMAT="%y-%m-%d %T "
-source /usr/share/git/completion/git-prompt.sh
-
-if [ "$TERM" == "st-256color" ]; then
- # Quick fix for ctrl+arrow key in st
- echo $(tput smkx) > /dev/tty
-fi
-
-###############
-PS1="${c_bold}${c_yellow}\
-┌[${c_green}\u${c_yellow}@${c_blue}\h${c_yellow}][${c_purple}\W${c_yellow}"'$(__git_ps1 " (%s)")'"] ${c_black}<\d \t>${c_yellow}\n\
-└╼ \[${c_off}\]"
-###############
-
-source ~/.aliases
-source ~/.environment
-
-echo Running $(uname) $(uname -r) on $(uname -n) \($(uname -m)\)
-
-if [ -f ~/todo ]; then
- echo To do:
- cat ~/todo
-fi
-
-if [ -f ~/.cache/weather/forecast ]; then
- echo ""
- echo Weather:
- cat ~/.cache/weather/forecast | while read -r l ; do echo " "$l ; done
-fi
+case $- in
+ *i*)
+ # interactive, continue fancy stuff. Printing anything when a
+ # non-interactive session is active breaks scp and other utils
+ source ~/.aliases
+ source ~/.environment
-[ -d ~/Maildir/new/ ] && [ "$(ls ~/Maildir/new/)" ] && echo 'New mail'
+ echo Running $(uname) $(uname -r) on $(uname -n) \($(uname -m)\)
+ ;;
+ *)
+ # non-interactive, don't do anything fancy
+ ;;
+esac
-[ -z "$(ls -A ~/.cache/currency 2>/dev/null)" ] || for c in ~/.cache/currency/* ; do
- echo "$(cat $c) (at $(date -d $(stat -c %Y $c) +"%a %d %H:%M"))"
-done