Only cat tips.txt if in an interactive shell
dblume

dblume commited on 2026-01-06 10:00:32
Showing 1 changed files, with 1 additions and 1 deletions.


Discovered while running shell commands in Claude Code,
that it'd print the tips file. So added the following check:

    $- == *i*
... ...
@@ -11,7 +11,7 @@ if [ -f "${HOME}/.bashrc" ]; then
11 11
     source "${HOME}/.bashrc"
12 12
 fi
13 13
 if [[ $(uname -s) == Darwin* ]]; then
14
-    if [[ -z $SSH_CLIENT && -f "${HOME}/tips.txt" ]]; then
14
+    if [[ $- == *i* && -z $SSH_CLIENT && -f "${HOME}/tips.txt" ]]; then
15 15
         cat "${HOME}/tips.txt"
16 16
     fi
17 17
     if [[ -n $CDPATH && -f $HOMEBREW_PREFIX/etc/bash_completion ]]; then
18 18