Command ppwd used in bash terminal prompt

I am looking into customization of my terminal prompts. I ran:

(base) tom@mydesktop:~> echo $PS1
(base) \[$(ppwd)\]\u@\h:\w>
(base) tom@mydesktop:~>

to see what was currently being used. I can find no reference in the literature related to prompts that give any information on the command “ppwd”.

Anyone have any idea of the significance of “ppwd”. Obviously some variation of pwd but can’t seem to find any info.

Note: The base part of the prompt is installed by miniconda python system.

thanks, tom kosvic

@tckosvic maybe an alias for pwd -P?

looked at user alias and also root alias and did not see ppwd.
Could alias be set elsewhere?

thanks for looking, tom kosvic

Found

I also independently found it in /etc/bash.bashrc Then saw note from @mburge.
Below is code section. I am unclear what it does. see below;

#
	# Set xterm prompt with short path (last 18 characters)
	#
	if _path tput hs 2>/dev/null || _path tput -T $TERM+sl hs 2>/dev/null || \
	   _path tput -T ${TERM%%[.-]*}+sl hs 2>/dev/null || \
	   [[ $TERM = *xterm* || $TERM = *gnome* || $TERM = *konsole* || $TERM = *xfce* ]]
	then
	    #
	    # Mirror prompt in terminal "status line", which for graphical
	    # terminals usually is the window title. KDE konsole in
	    # addition needs to have "%w" in the "tabs" setting, ymmv for
	    # other console emulators.
	    #
	    if [[ $TERM = *xterm* || $TERM = *gnome* || $TERM = *konsole* || $TERM = *xfce* ]]
	    then
		# https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Miscellaneous
		_tsl=$(echo -en '\e]2;')
		_isl=$(echo -en '\e]1;')
		_fsl=$(echo -en '\007')
	    elif _path tput -T $TERM+sl tsl 2>/dev/null ; then
		_tsl=$(_path tput -T $TERM+sl tsl 2>/dev/null)
		_isl=''
		_fsl=$(_path tput -T $TERM+sl fsl 2>/dev/null)
	    elif _path tput -T ${TERM%%[.-]*}+sl tsl 2>/dev/null ; then
		_tsl=$(_path tput -T $TERM+sl tsl 2>/dev/null)
		_isl=''
		_fsl=$(_path tput -T $TERM+sl fsl 2>/dev/null)
	    else
		_tsl=$(_path tput tsl 2>/dev/null)
		_isl=''
		_fsl=$(_path tput fsl 2>/dev/null)
	    fi
	    _sc=$(tput sc 2>/dev/null)
	    _rc=$(tput rc 2>/dev/null)
	    if test -n "$_tsl" -a -n "$_isl" -a "$_fsl" ; then
		TS1="$_sc$_tsl%s@%s:%s$_fsl$_isl%s$_fsl$_rc"
	    elif test -n "$_tsl" -a "$_fsl" ; then
		TS1="$_sc$_tsl%s@%s:%s$_fsl$_rc"
	    fi
	    unset _isl _tsl _fsl _sc _rc
	    ppwd () {              <<<<<<<<< ------------------------------------------------------------  ppwd
		local dir
		local -i width
		test -n "$TS1" || return;
		dir="$(dirs +0)"
		let width=${#dir}-18
		test ${#dir} -le 18 || dir="...${dir#$(printf "%.*s" $width "$dir")}"
		if test ${#TS1} -gt 17 ; then
		    printf "$TS1" "$USER" "$HOST" "$dir" "$HOST"
		else
		    printf "$TS1" "$USER" "$HOST" "$dir"
		fi
	    }
	else
	    ppwd () { true; }
	fi

See if anyone can clarify this. tom kosvic

42.3 was EOL years ago. We don’t support that anymore

The version was/is of little relevance, the discussion is what the code does.

	    ppwd () {
		local dir #local var `dir`
		local -i width #local integer variable
		test -n "$TS1" || return; #Check if TS1(timestamp?)
		dir="$(dirs +0)" #get current path
		let width=${#dir}-18 #get diff of dirs.len - 18
		test ${#dir} -le 18 || dir="...${dir#$(printf "%.*s" $width "$dir")}" #shorten to `...some/18chars`
		if test ${#TS1} -gt 17 ; then #take into account TS width
		    printf "$TS1" "$USER" "$HOST" "$dir" "$HOST"
		else
		    printf "$TS1" "$USER" "$HOST" "$dir"
		fi
	    }
	else
	    ppwd () { true; }
	fi
user@ost:~/Downloads/cudnn-linux-x86_64-8.9.7.29_cuda12-archive$ ~/btest.sh 
 user  ....29_cuda12-archive

This is Leap 15.5.

henk@boven:~> LANG=C type ppwd
ppwd is a function
ppwd () 
{ 
    local dir;
    local -i width;
    test -n "$TS1" || return;
    dir="$(dirs +0)";
    let width=${#dir}-18;
    test ${#dir} -le 18 || dir="...${dir#$(printf "%.*s" $width "$dir")}";
    if test ${#TS1} -gt 17; then
        printf "$TS1" "$USER" "$HOST" "$dir" "$HOST";
    else
        printf "$TS1" "$USER" "$HOST" "$dir";
    fi
}
henk@boven:~>

I am curious, who are those “we” you are referring to?

The maintainers

You can easily see what the code does by removing the invocation of ppwd from your PS1 and comparing the result. Otherwise you probably need to ask more specific question(s) which are likely more in place on Programming subforum.

No, it is not timestamp, it is just shell variable that is defined and set in the earlier code of the script containing definition of this function.