• Re: bash prompt question

    From Brian Patrie@21:1/5 to Chris Elvidge on Mon Sep 23 03:07:07 2024
    Chris Elvidge wrote:
    try export PS1='\[\e[1;35m\]\u@\h -\d- ${text} \W\[\e[00m\]\$ '

    In bash (and most shells), PS1, etc do not need to be exported; as long
    as they're set in .bashrc, they will be set in every interactive bash
    session. Moreover, exporting them will make a mess in sh:

    $ export PS1='\[\e[1;35m\]\u@\h -\d- ${text} \W\[\e[00m\]\$ '
    foh@enceladus -Mon Sep 23- ~$ sh
    \[\e[1;35m\]\u@\h -\d- \W\[\e[00m\]$

    sh (and its clones)--which don't support an rc file--are, of course, the exception to this rule.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Geoff Clare@21:1/5 to Brian Patrie on Mon Sep 23 13:44:09 2024
    Brian Patrie wrote:

    sh (and its clones)--which don't support an rc file--are, of course, the exception to this rule.

    You don't count a file specified in ENV as an "rc file" ?

    --
    Geoff Clare <netnews@gclare.org.uk>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Brian Patrie@21:1/5 to Geoff Clare on Tue Sep 24 01:42:47 2024
    Geoff Clare wrote:
    Brian Patrie wrote:
    sh (and its clones)--which don't support an rc file--are,
    of course, the exception to this rule.

    You don't count a file specified in ENV as an "rc file" ?

    Not all shells support ENV. dash doesn't seem to. Even if they did, it
    would still be a bad idea to export the prompt strings in other shells.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Damien Wyart@21:1/5 to All on Tue Sep 24 10:06:51 2024
    * Franτois Patte <francois.patte@mi.parisdescartes.fr> in comp.unix.shell:
    Wanting to personalize my bash prompt I wrote in my .bashrc file (with
    the help of "Learning the BASH shell"):

    export PS1='\[\e[1;35m\]\u@\h -\d- ${text} \W\[\e[m]\]\$ '

    While it is useful to play with PS1 for learning purposes, to be able to customize
    your prompt easily and in a powerful way, I advise the use of a framework prompt.
    There are many of them, one I really like is Starship:

    https://starship.rs/
    https://github.com/starship/starship

    --
    DW

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Geoff Clare@21:1/5 to Brian Patrie on Tue Sep 24 13:26:01 2024
    Brian Patrie wrote:

    Geoff Clare wrote:
    Brian Patrie wrote:
    sh (and its clones)--which don't support an rc file--are,
    of course, the exception to this rule.

    You don't count a file specified in ENV as an "rc file" ?

    Not all shells support ENV. dash doesn't seem to.

    The dash man page on my Debian system says ENV is supported.

    Even if they did, it would still be a bad idea to export the prompt
    strings in other shells.

    Depends what you put in them. Personally I only use what POSIX
    requires to be supported, so exporting is not a problem (and I do
    export PS1).

    --
    Geoff Clare <netnews@gclare.org.uk>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Damien Wyart on Tue Sep 24 17:47:15 2024
    On 2024-09-24, Damien Wyart <damien.wyart@free.fr> wrote:
    * François Patte <francois.patte@mi.parisdescartes.fr> in comp.unix.shell:
    Wanting to personalize my bash prompt I wrote in my .bashrc file (with
    the help of "Learning the BASH shell"):

    export PS1='\[\e[1;35m\]\u@\h -\d- ${text} \W\[\e[m]\]\$ '

    While it is useful to play with PS1 for learning purposes, to be able to customize
    your prompt easily and in a powerful way, I advise the use of a framework prompt.
    There are many of them, one I really like is Starship:

    https://starship.rs/
    https://github.com/starship/starship

    Or you can put some info into a scroll-protected status line and just
    have $ as your prompt, via a tiny file you just source from your
    .bashrc:

    https://www.kylheku.com/cgit/basta/about/

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Damien Wyart on Tue Sep 24 18:04:44 2024
    On 2024-09-24, Damien Wyart <damien.wyart@free.fr> wrote:
    * François Patte <francois.patte@mi.parisdescartes.fr> in comp.unix.shell:
    Wanting to personalize my bash prompt I wrote in my .bashrc file (with
    the help of "Learning the BASH shell"):

    export PS1='\[\e[1;35m\]\u@\h -\d- ${text} \W\[\e[m]\]\$ '

    While it is useful to play with PS1 for learning purposes, to be able to customize
    your prompt easily and in a powerful way, I advise the use of a framework prompt.
    There are many of them, one I really like is Starship:

    https://starship.rs/
    https://github.com/starship/starship

    This is fucking retarded. It consists of dozens of Rust source files,
    not to mention .json, .yaml and other cruft.

    ... for customizing shell prompts?

    Please tell me it's an April Fool's joke!

    You must not be old enough to remember simple computing with low
    dependencies, and are probably grateful that you don't need a cloud
    account and API key to use this. Or, wait, don't tell me ...

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to 643-408-1753@kylheku.com on Tue Sep 24 18:50:55 2024
    In article <20240924104900.445@kylheku.com>,
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    ...
    This is fucking retarded. It consists of dozens of Rust source files,
    not to mention .json, .yaml and other cruft.

    Yeah, that was the sense I was getting of it.

    It looked to me like he was just trying to get people to click on his
    links. Still, we must remain charitable. Sometimes, this is the only
    path available for some folks to get out of their third world shithole.

    ... for customizing shell prompts?

    Please tell me it's an April Fool's joke!

    More likely, just clickbait.

    You must not be old enough to remember simple computing with low >dependencies, and are probably grateful that you don't need a cloud
    account and API key to use this. Or, wait, don't tell me ...

    Probably so.

    --
    A Catholic woman tells her husband to buy Viagra.

    A Jewish woman tells her husband to buy Pfizer.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Damien Wyart@21:1/5 to All on Wed Sep 25 08:02:57 2024
    * Kaz Kylheku <643-408-1753@kylheku.com> in comp.unix.shell:
    You must not be old enough to remember simple computing with low
    dependencies

    I have been using Unixes daily since 1996.

    --
    DW

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Fran=C3=A7ois_Patte?=@21:1/5 to All on Thu Sep 19 12:34:55 2024
    Bonjour,

    Wanting to personalize my bash prompt I wrote in my .bashrc file (with
    the help of "Learning the BASH shell"):

    export PS1='\[\e[1;35m\]\u@\h -\d- ${text} \W\[\e[m]\]\$ '

    What I wanted by this :
    specific color
    user@host
    the date
    wether I am on a local machine: nothing or on a remote one: ssh
    and the directory

    It works but not very well: if I use the up/down arrows to call back a
    previous command, the behaviour changes, sometimes as if I used the keys "Inser" or "Suppr" and at the end the usage becomes awfull.

    What did I do wrong?

    I hope to be understable in English language....

    Thank you for helping.

    François Patte

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Elvidge@21:1/5 to All on Thu Sep 19 12:20:40 2024
    On 19/09/2024 at 11:34, François Patte wrote:
    Bonjour,

    Wanting to personalize my bash prompt I wrote in my .bashrc file (with
    the help of "Learning the BASH shell"):

    export PS1='\[\e[1;35m\]\u@\h -\d- ${text} \W\[\e[m]\]\$ '

    try export PS1='\[\e[1;35m\]\u@\h -\d- ${text} \W\[\e[00m\]\$ '

    where do you set $text?


    What I wanted by this :
    specific color
    user@host
    the date
    wether I am on a local machine: nothing or on a remote one: ssh
    and the directory

    It works but not very well: if I use the up/down arrows to call back a previous command, the behaviour changes, sometimes as if I used the keys "Inser" or "Suppr" and at the end the usage becomes awfull.

    What did I do wrong?

    I hope to be understable in English language....

    Thank you for helping.

    François Patte



    --
    Chris Elvidge, England
    I WILL NOT SELL MY KIDNEY ON eBAY

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Fran=C3=A7ois_Patte?=@21:1/5 to All on Thu Sep 19 14:30:19 2024
    Le 19/09/2024 à 13:20, Chris Elvidge a écrit :
    On 19/09/2024 at 11:34, François Patte wrote:
    Bonjour,

    Wanting to personalize my bash prompt I wrote in my .bashrc file (with
    the help of "Learning the BASH shell"):

      export PS1='\[\e[1;35m\]\u@\h -\d- ${text} \W\[\e[m]\]\$ '

    try export PS1='\[\e[1;35m\]\u@\h -\d- ${text} \W\[\e[00m\]\$ '

    I will try this. Thank you.


    where do you set $text?

    I don't know! That's strange... I did this a long time ago and I can't
    remember where I picked up this.

    Doing "echo $text" on a local machine, this returns nothing and on a
    remote one, I get ssh (of course, I am logged to the remote machine,
    using ssh)

    Thank you for helping

    F.P.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Gilmeh Serda@21:1/5 to All on Thu Sep 19 18:28:05 2024
    On Thu, 19 Sep 2024 12:34:55 +0200, François Patte wrote:

    Wanting to personalize my bash prompt I wrote in my .bashrc file (with
    the help of "Learning the BASH shell"):

    You could try something like this:
    https://bash-prompt-generator.org/

    Might or might not work for your needs.

    I'm sure there must be similar projects out there.

    --
    Gilmeh

    What's a cult? It just means not enough people to make a minority. --
    Robert Altman

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)