This should do the trick
pwd | tr '/' '
'
If you don't want an empty line in the beginning (due to the initial /
) you could do
pwd | cut -b2- | tr '/' '
'
Example:
#aioobe@r60:~/tmp/files$ pwd
/home/aioobe/tmp/files
#aioobe@r60:~/tmp/files$ pwd | cut -b2- | tr '/' '
'
home
aioobe
tmp
files
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…