From f23c3ab35ca3ada5ae8c44dd50e67e215c18598f Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Thu, 4 Feb 2021 13:42:25 +0200 Subject: [PATCH] Default value for set_title. Use the basename for the current directory as the default title. --- .bashrc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index 99538bd..66f49de 100644 --- a/.bashrc +++ b/.bashrc @@ -136,7 +136,6 @@ alias restart-kodi='ssh kodi.shore.co.il "sudo systemctl kill --kill-who=all --s # shellcheck disable=SC2032 alias rm='rm --dir' alias screenshot-cleanup='find "$HOME/Pictures" -name "Screenshot from *.png" -delete' -alias set_title='printf "\033]0;%s\007"' alias smtp-server='python3 -m smtpd -ndc DebuggingServer' alias sudo="sudo " alias sudome="sudome " @@ -207,6 +206,12 @@ prune_ssh_sockets () { -execdir sh -c 'lsof -t "$1" >/dev/null || rm "$1"' _ {} \; } +set_title () { + local default_title + default_title="$(basename "$PWD")" + printf "\033]0;%s\007" "${1:-$default_title}" +} + ssh_keyscan_add () { ssh-keyscan "$@" >> "$HOME/.ssh/known_hosts" sort -uo "$HOME/.ssh/known_hosts" "$HOME/.ssh/known_hosts" -- GitLab