a-shell icon indicating copy to clipboard operation
a-shell copied to clipboard

Show Current Working Directory in Prompt?

Open chriscconte opened this issue 3 years ago • 13 comments

Is there a way to show the working directory in the Prompt?

E.g.

~ $ /Library/bin $

Potentially able to only show the directories within the application ID 😁

chriscconte avatar Oct 06 '20 15:10 chriscconte

This feature is not available for the time being. It is on the TODO list, but there are issues to consider. Ideally, I'd like to use a syntax that people are familiar with, and at the same time I'd like the default behaviour to produce something useable.

Directories in iOS tend to be quite long, and displays can be quite small.

holzschu avatar Oct 06 '20 16:10 holzschu

just type pwd to show your current path

binex-dsk avatar Oct 07 '20 20:10 binex-dsk

This feature is not available for the time being. It is on the TODO list, but there are issues to consider. Ideally, I'd like to use a syntax that people are familiar with, and at the same time I'd like the default behaviour to produce something useable.

Directories in iOS tend to be quite long, and displays can be quite small.

As an intermediate step, perhaps you could offer a way to change the color of the $ prompt? It will help a great deal for scrolling through pages of text with intermingled input and output.

chchen2021 avatar Jul 16 '21 00:07 chchen2021

This feature is not available for the time being. It is on the TODO list, but there are issues to consider. Ideally, I'd like to use a syntax that people are familiar with, and at the same time I'd like the default behaviour to produce something useable.

Directories in iOS tend to be quite long, and displays can be quite small.

@holzschu I noticed that v1.9.0 now allows prompt customization. But I am having a hard time figuring out the syntax. Could you please give some examples?

chchen2021 avatar May 19 '22 22:05 chchen2021

It follows the bash syntax: \w for current directory with path (but shortened using ~ as much as possible), \W for current directory, \t for the time... This page (any others) have the list of commands: https://www.howtogeek.com/307701/how-to-customize-and-colorize-your-bash-prompt/

All of this goes into the PS1 environment variable.

holzschu avatar May 20 '22 05:05 holzschu

I was able to follow these instructions on another Ubuntu virtual machine, but not on a-Shell. This is what I am getting:

[~/Documents]$ PS1="\u:\w\$ "
PS1="u:w$: command not found
[~/Documents]$ export PS1="\u:\w\$ "
"u:w$

chchen2021 avatar May 20 '22 10:05 chchen2021

Try with setenv PS1 "\u:\w$ " export is not behaving as expected, but export PS1=\\u:\\w$ will give you what you want (i.e. no double quotes). I'll have a look at why export does not do what it should do.

holzschu avatar May 20 '22 10:05 holzschu

I can confirm setenv works both in the command line and in a .profile. Thanks.

chchen2021 avatar May 20 '22 10:05 chchen2021

@holzschu While we are at this, I would like to alert you of a small bug on the iPhone. When I start a-Shell, I get $ $ as the prompt. A simple return will yield the prompt I have customized for. The iPad version does not have this issue.

$ $ 
[~/Documents] $ 

chchen2021 avatar May 20 '22 11:05 chchen2021

Version 1.9.1 is now out, it should fix this issue with export.

holzschu avatar May 21 '22 06:05 holzschu

@holzschu While we are at this, I would like to alert you of a small bug on the iPhone. When I start a-Shell, I get $ $ as the prompt. A simple return will yield the prompt I have customized for. The iPad version does not have this issue.

$ $ 
[~/Documents] $ 

A reinstallation of A-Shell got rid of the $ $. Now the iPhone prompt behaves the same way as the iPad Prompt.

chchen2021 avatar May 30 '22 19:05 chchen2021

I suspect this was a-Shell restoring the content of a previous session.

holzschu avatar May 31 '22 12:05 holzschu

The $ $ crept back again with some usage after the fresh installation.

chchen2021 avatar Jun 05 '22 16:06 chchen2021