Tiny Core Linux
General TC => General TC Talk => Topic started by: TomyTurbos on February 17, 2019, 11:31:29 PM
-
I feel like a total newb asking this...
What I want is my prompt to be as follows:
(user)@(host)[color][maybe date and time here?]
(current-directory)[different-color]
{type-stuff-here[different-color]} <--this is the cursor behavior.
The newlines are significant.
I'm looking but not finding a succinct answer for how this might be done.
'(current-directory)' should be explicit path name for PWD.
TIA.
-
Here's an example of what I mean:
foo@bar 25:61 02/30/3147
/home/foo
{cursor}
-
Hi TomyTurbos
Try this in a terminal:
export PS1='\u@\h:${YELLOW}$(date "+%a %b %d %T") ${RED}$PWD\$${GREEN} '
Alter the PS1 variable in your .profile file to make it permanent.
-
Hi TomyTurbos
The above example was derived from these threads:
http://forum.tinycorelinux.net/index.php/topic,10429.msg55808.html#msg55808
http://forum.tinycorelinux.net/index.php/topic,3281.msg17139.html#msg17139
Here's an example that modifies the title bar of a terminal so it dynamically lists the current directory:
http://forum.tinycorelinux.net/index.php/topic,274.msg1657.html#msg1657
and a link from that thread that may be useful:
http://www.faqs.org/docs/Linux-mini/Xterm-Title.html
-
Thanks for all that, rich. I'll get back to you after school...
-
Well, after some experimentation I wound up with what I wanted by using this in '/home/tc/.profile':
PS1='n\ ${RED}$(date "+%a %b %d %T")\n ${WHITE}\u@\h:\n ${BLUE}$PWD\/\n${GREEN}>> ${WHITE}'
My prompt now shows as:
Day Month Date Time
User@Host
Current Directory
>>
Note: These are indented by one space. The line in the middle is white.
Part of the reason for doing this was to make it easier to find the breakpoints when scrolling back through a long list of terminal output.
But during the process I noted some unusual behavior in aterm while using 'export' and testing this. At some point the command became lengthy enough that it could no longer be edited without restarting. Backspace and Delete became Paste.
As I said above, I solved my problem and have no more concern for the matter, but this reveals a fluke elsewhere in the system. I thought I should report it.
-
Hi TomyTurbos
Well, after some experimentation I wound up with what I wanted by using this in '/home/tc/.profile':
PS1='n\ ${RED}$(date "+%a %b %d %T")\n ${WHITE}\u@\h:\n ${BLUE}$PWD\/\n${GREEN}>> ${WHITE}'
If that code snippet is accurate, then the n\ at the beginning is a typo and might account for the unusual behavior you mentioned.
It should be \n if you intended to put a linefeed there.
-
Yes, that is a typo.