[OpenWrt-Devel] Hang on setting $PROMPT in master
Koen Vandeputte
koen.vandeputte at ncentric.com
Mon Oct 21 11:10:15 EDT 2019
On 21.10.19 17:04, Martin Tippmann wrote:
> We are using a shell-function to set the prompt based on return code -
> it works fine in 17.01 / 18.06 / 19.07, however in current master when
> the function is run the terminal/ssh session hangs.
>
> how to reproduce:
>
>
>
> <--- hang.sh:
> #!/bin/sh
You could add following line here to check where it hangs:
set -x
> prompt_set() {
> face() {
> local rc=$?
> case "$rc" in
> 0) printf '%s' "$1" ;;
> *) printf '%s' "$2" ; return $rc ;;
> esac
> }
>
> local e='\[\e' # start escape-sequence
> local c='\]' # close escape-sequence
>
> local user='\u'
> local wdir='\w' # workdir
> local host='\h' # short form
>
> local reset="${e}[0m${c}" # all attributes
> local white="${e}[37m${c}"
> local cyan="${e}[36m${c}"
> local yellow="${e}[33;1m${c}" # bold
> local green="${e}[32m${c}"
> local red="${e}[31m${c}"
>
> local ok="${green}:)"
> local bad="${red}8("
>
> # e.g. user at hostname:~ :)
> export PS1="${cyan}${user}$white@${green}$host:${yellow}$wdir \$(
> face '$ok' '$bad' ) $reset"
> }
>
> prompt_set
> -->
>
> now source the file:
>
> . ./hang.sh
>
> shellcheck does not complain - I'm writing because I'm not sure wether
> this invalid sh that happened to work anyway or is this a
> bug/regression in ash?
>
> regards
> Martin
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list