diff options
author | Karel Kočí <cynerd@email.cz> | 2022-06-09 15:12:50 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2022-06-09 15:12:50 +0200 |
commit | 9e4f4d2631b2d9ba537f25299c5d9fc5783ca776 (patch) | |
tree | a00e9b3f585c1a12a38ddc47ab08211720d1977c | |
parent | f2e5e9e814cb860b005faeeddec2959768c0f559 (diff) | |
download | shellrc-9e4f4d2631b2d9ba537f25299c5d9fc5783ca776.tar.gz shellrc-9e4f4d2631b2d9ba537f25299c5d9fc5783ca776.tar.bz2 shellrc-9e4f4d2631b2d9ba537f25299c5d9fc5783ca776.zip |
bashrc: prevent errors about missing commands
This happens in Nix when entering the new environment due to commad not
being available yet.
-rw-r--r-- | bashrc.d/title | 4 |
1 files changed, 3 insertions, 1 deletions
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 |