aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-05-31 18:15:39 +1200
committerTom Ryder <tom@sanctum.geek.nz>2017-05-31 18:15:39 +1200
commit656da025bb037b816b2e7be9102a6705772207b8 (patch)
tree7fad79f7c595d0ae181726b9a7135becbd50d55a /sh
parent8ca2f8db01b8660a235bede6987bd31e5cc63c14 (diff)
downloaddotfiles-656da025bb037b816b2e7be9102a6705772207b8.tar.gz
Conditions for downloads.sh
Diffstat (limited to 'sh')
-rw-r--r--sh/profile.d/downloads.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/sh/profile.d/downloads.sh b/sh/profile.d/downloads.sh
index 4c57ddfd..fb8dd64a 100644
--- a/sh/profile.d/downloads.sh
+++ b/sh/profile.d/downloads.sh
@@ -1,4 +1,19 @@
+# Only if shell is interactive
+case $- in
+ *i*) ;;
+ *) return ;;
+esac
+
+# Only if not in a tmux window
+[ -z "$TMUX" ] || return
+
+# Not if ~/.hushlogin exists
+[ -e "$HOME"/.hushlogin ] && return
+
+# Not if ~/.downloads doesn't
[ -f "$HOME"/.downloads ] || return
+
+# Count files in each directory, report if greater than zero
(
while IFS= read -r dir ; do
case $dir in