这是indexloc提供的服务,不要输入任何密码
Skip to content

New session not expanding \W in bash prompt correctly #1413

@mklein994

Description

@mklein994

Problem description

When I create a new session in Termux, the bash prompt ($PS1) doesn't expand \W as expected.

Steps to reproduce

Setup:

# ~/.bashrc
export PS1='\W$ '

Initial session:

~$ pwd && echo $PWD
/data/data/com.termux/files/home
/data/data/com.termux/files/home
~$ mkdir -p test/dir
~$ cd test/dir
dir$ pwd && echo $PWD
/data/data/com.termux/files/home/test/dir
/data/data/com.termux/files/home/test/dir
dir$ 

In a new session:

$ pwd && echo $PWD
/data/data/com.termux/files/home/test/dir
/data/data/com.termux/files/home/test/dir/
$ 

Expected behavior

Opening a new session shouldn't mangle the prompt. It seems the \W escape character isn't expecting a trailing slash in $PWD.

Additional information

termux-info:

Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://termux.org/packages/ stable main
# game-repo (sources.list.d/game.list)
deb https://dl.bintray.com/grimler/game-packages-24 games stable
# sources.list.d/pointless.list
deb https://its-pointless.github.io/files/24 termux extras
# science-repo (sources.list.d/science.list)
deb https://dl.bintray.com/grimler/science-packages-24 science stable
# unstable-repo (sources.list.d/unstable.list)
deb https://dl.bintray.com/xeffyr/unstable-packages unstable main
Updatable packages:
All packages up to date
Android version:
9
Kernel build information:
Linux localhost 4.14.83-perf+ #1 SMP PREEMPT Thu Sep 26 15:22:17 KST 2019 aarch64 Android
Device manufacturer:
LGE
Device model:
LM-G820

I can provide logcat logs if you need them.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions