From 9e4f4d2631b2d9ba537f25299c5d9fc5783ca776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 9 Jun 2022 15:12:50 +0200 Subject: bashrc: prevent errors about missing commands This happens in Nix when entering the new environment due to commad not being available yet. --- bashrc.d/title | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bashrc.d/title b/bashrc.d/title index d6bb5e1..e391855 100644 --- a/bashrc.d/title +++ b/bashrc.d/title @@ -1,7 +1,9 @@ # vim: ft=sh function settitle { - echo -ne "\033]0;`whoami`@`hostname`:`pwd`\007" + if command -v whoami >/dev/null && command -v hostname >/dev/null && command -v pwd >/dev/null; then + echo -ne "\033]0;$(whoami)@$(hostname):$(pwd)\007" + fi } case "$TERM" in -- cgit v1.2.3