aboutsummaryrefslogtreecommitdiff
path: root/bashrc.d/title
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2022-06-09 15:12:50 +0200
committerKarel Kočí <cynerd@email.cz>2022-06-09 15:12:50 +0200
commit9e4f4d2631b2d9ba537f25299c5d9fc5783ca776 (patch)
treea00e9b3f585c1a12a38ddc47ab08211720d1977c /bashrc.d/title
parentf2e5e9e814cb860b005faeeddec2959768c0f559 (diff)
downloadshellrc-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.
Diffstat (limited to 'bashrc.d/title')
-rw-r--r--bashrc.d/title4
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