From 8cc85ff3ffe5ebd1260ed276fc2b35621ccfba55 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 27 Jan 2017 13:03:09 +1300 Subject: Extend "fallback" prompt a bit Include username/hostname if no SSH variables --- sh/shrc.d/prompt.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sh') diff --git a/sh/shrc.d/prompt.sh b/sh/shrc.d/prompt.sh index a481b5bb..f1b67fb4 100644 --- a/sh/shrc.d/prompt.sh +++ b/sh/shrc.d/prompt.sh @@ -3,3 +3,9 @@ # it to break the export and then just setting them as simple variables unset PS1 PS2 PS3 PS4 PS1='$ ' PS2='> ' PS3='? ' PS4='+ ' + +# If we have an SSH_CLIENT or SSH_CONNECTION environment variable, put the +# username and hostname in PS1 too. +if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_CONNECTION" ] ; then + PS1=$(id -nu)'@'$(hostname)'$ ' +fi -- cgit v1.2.3 From 853ac278289d0a92497a5189e2cb18a2b46482c5 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 27 Jan 2017 14:02:05 +1300 Subject: s/exit/return/ in ex-subshell func --- sh/profile.d/options.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sh') diff --git a/sh/profile.d/options.sh b/sh/profile.d/options.sh index a668a360..1a511d75 100644 --- a/sh/profile.d/options.sh +++ b/sh/profile.d/options.sh @@ -10,15 +10,15 @@ options() { shift # Directory already exists; bail out - [ -d "$dir" ] && exit + [ -d "$dir" ] && return # Create the directory and step into it - command -p mkdir -p -- "$dir" || exit - cd -- "$dir" || exit + command -p mkdir -p -- "$dir" || return + cd -- "$dir" || return # Write the program's --help output to a file, even if it's empty # This probably only works with GNU tools in general - "$prog" --help help 2>/dev/null || exit + "$prog" --help help 2>/dev/null || return # Iterate through remaining arguments (desired options), creating files to # show they're available if found in the help output -- cgit v1.2.3