Skip to main content

fish_functions: only put $TMPDIR in prompt if $TMPDIR is defined

ID
b27b233
date
2026-04-18 11:52:13+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
85e6449
message
fish_functions: only put $TMPDIR in prompt if $TMPDIR is defined
changed files
1 file, 1 addition, 1 deletion

Changed files

fish_functions/fish_prompt.fish (5205) → fish_functions/fish_prompt.fish (5228)

diff --git a/fish_functions/fish_prompt.fish b/fish_functions/fish_prompt.fish
index e94df46..eef8928 100644
--- a/fish_functions/fish_prompt.fish
+++ b/fish_functions/fish_prompt.fish
@@ -8,7 +8,7 @@
 
 function print_current_directory
     set_color green
-    if string match -q "$TMPDIR*" (pwd)
+    if string match -q "$TMPDIR*" (pwd); and test -n "$TMPDIR"
         set remaining (string replace -r "^$TMPDIR" "" (pwd))
         printf (echo -n "\$TMPDIR/$remaining")
     else