Cannot export PS1 over SSH











up vote
1
down vote

favorite












Trying to customize shell prompt on a Ubuntu 18 LTS server over SSH.



On the server, the .profile sources .bashrc correctly, and .bashrc has force_color_prompt=yes uncommented. The prompt is not colored.



Tried setting it manually. It does not export:





user@ubuntu ~ $ export PS1="[ ${debian_chroot:+($debian_chroot)}u is awesome: w ]\$ "
user@ubuntu ~ $ echo $PS1
u@h w $


But as root it works fine:



user@ubuntu ~ $ sudo su
root@ubuntu:/home/user# export PS1="[ ${debian_chroot:+($debian_chroot)}u is awesome: w ]\$ "
[ root is awesome: /home/user ]#


What is going on?










share|improve this question
























  • Perhaps your ordinary user's login shell is not bash?
    – steeldriver
    Nov 28 at 17:06






  • 1




    Please edit your question and show us the output of echo $PROMPT_COMMAND. Ideally, show us the entire contents of your ~/.bashrc. Also show us the output of ps -p $$ as your regular user. @steeldriver are there any shells that accept the foo=bar syntax for variables and don't support PS1? It's defined by POSIX for sh so I would be very surprised to find an sh-like shell that doesn't understand it.
    – terdon
    Nov 28 at 17:55















up vote
1
down vote

favorite












Trying to customize shell prompt on a Ubuntu 18 LTS server over SSH.



On the server, the .profile sources .bashrc correctly, and .bashrc has force_color_prompt=yes uncommented. The prompt is not colored.



Tried setting it manually. It does not export:





user@ubuntu ~ $ export PS1="[ ${debian_chroot:+($debian_chroot)}u is awesome: w ]\$ "
user@ubuntu ~ $ echo $PS1
u@h w $


But as root it works fine:



user@ubuntu ~ $ sudo su
root@ubuntu:/home/user# export PS1="[ ${debian_chroot:+($debian_chroot)}u is awesome: w ]\$ "
[ root is awesome: /home/user ]#


What is going on?










share|improve this question
























  • Perhaps your ordinary user's login shell is not bash?
    – steeldriver
    Nov 28 at 17:06






  • 1




    Please edit your question and show us the output of echo $PROMPT_COMMAND. Ideally, show us the entire contents of your ~/.bashrc. Also show us the output of ps -p $$ as your regular user. @steeldriver are there any shells that accept the foo=bar syntax for variables and don't support PS1? It's defined by POSIX for sh so I would be very surprised to find an sh-like shell that doesn't understand it.
    – terdon
    Nov 28 at 17:55













up vote
1
down vote

favorite









up vote
1
down vote

favorite











Trying to customize shell prompt on a Ubuntu 18 LTS server over SSH.



On the server, the .profile sources .bashrc correctly, and .bashrc has force_color_prompt=yes uncommented. The prompt is not colored.



Tried setting it manually. It does not export:





user@ubuntu ~ $ export PS1="[ ${debian_chroot:+($debian_chroot)}u is awesome: w ]\$ "
user@ubuntu ~ $ echo $PS1
u@h w $


But as root it works fine:



user@ubuntu ~ $ sudo su
root@ubuntu:/home/user# export PS1="[ ${debian_chroot:+($debian_chroot)}u is awesome: w ]\$ "
[ root is awesome: /home/user ]#


What is going on?










share|improve this question















Trying to customize shell prompt on a Ubuntu 18 LTS server over SSH.



On the server, the .profile sources .bashrc correctly, and .bashrc has force_color_prompt=yes uncommented. The prompt is not colored.



Tried setting it manually. It does not export:





user@ubuntu ~ $ export PS1="[ ${debian_chroot:+($debian_chroot)}u is awesome: w ]\$ "
user@ubuntu ~ $ echo $PS1
u@h w $


But as root it works fine:



user@ubuntu ~ $ sudo su
root@ubuntu:/home/user# export PS1="[ ${debian_chroot:+($debian_chroot)}u is awesome: w ]\$ "
[ root is awesome: /home/user ]#


What is going on?







bash ssh bashrc prompt






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 28 at 17:55









terdon

63.5k12133210




63.5k12133210










asked Nov 28 at 16:38









Sqerstet

183211




183211












  • Perhaps your ordinary user's login shell is not bash?
    – steeldriver
    Nov 28 at 17:06






  • 1




    Please edit your question and show us the output of echo $PROMPT_COMMAND. Ideally, show us the entire contents of your ~/.bashrc. Also show us the output of ps -p $$ as your regular user. @steeldriver are there any shells that accept the foo=bar syntax for variables and don't support PS1? It's defined by POSIX for sh so I would be very surprised to find an sh-like shell that doesn't understand it.
    – terdon
    Nov 28 at 17:55


















  • Perhaps your ordinary user's login shell is not bash?
    – steeldriver
    Nov 28 at 17:06






  • 1




    Please edit your question and show us the output of echo $PROMPT_COMMAND. Ideally, show us the entire contents of your ~/.bashrc. Also show us the output of ps -p $$ as your regular user. @steeldriver are there any shells that accept the foo=bar syntax for variables and don't support PS1? It's defined by POSIX for sh so I would be very surprised to find an sh-like shell that doesn't understand it.
    – terdon
    Nov 28 at 17:55
















Perhaps your ordinary user's login shell is not bash?
– steeldriver
Nov 28 at 17:06




Perhaps your ordinary user's login shell is not bash?
– steeldriver
Nov 28 at 17:06




1




1




Please edit your question and show us the output of echo $PROMPT_COMMAND. Ideally, show us the entire contents of your ~/.bashrc. Also show us the output of ps -p $$ as your regular user. @steeldriver are there any shells that accept the foo=bar syntax for variables and don't support PS1? It's defined by POSIX for sh so I would be very surprised to find an sh-like shell that doesn't understand it.
– terdon
Nov 28 at 17:55




Please edit your question and show us the output of echo $PROMPT_COMMAND. Ideally, show us the entire contents of your ~/.bashrc. Also show us the output of ps -p $$ as your regular user. @steeldriver are there any shells that accept the foo=bar syntax for variables and don't support PS1? It's defined by POSIX for sh so I would be very surprised to find an sh-like shell that doesn't understand it.
– terdon
Nov 28 at 17:55










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Checked $PROMPT_COMMAND as advised by @terdon:



user@ubuntu ~ $ echo $PROMPT_COMMAND
__git_ps1 "u@h w" "$(__drush_ps1 "[%s]") \$ "


Then looked harder at .bashrc and found:



# Include Drush prompt customizations.
if [ -f "/home/user/.drush/drush.prompt.sh" ] ; then
source /home/user/.drush/drush.prompt.sh
fi


Drush was setting its own $PROMPT_COMMAND, apparently instead of PS1. Not sure how PS1 gets overwritten by this, but it does. Commenting out Drush's superfluous customization makes the problem go away. Thanks to @terdon.






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1096867%2fcannot-export-ps1-over-ssh%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Checked $PROMPT_COMMAND as advised by @terdon:



    user@ubuntu ~ $ echo $PROMPT_COMMAND
    __git_ps1 "u@h w" "$(__drush_ps1 "[%s]") \$ "


    Then looked harder at .bashrc and found:



    # Include Drush prompt customizations.
    if [ -f "/home/user/.drush/drush.prompt.sh" ] ; then
    source /home/user/.drush/drush.prompt.sh
    fi


    Drush was setting its own $PROMPT_COMMAND, apparently instead of PS1. Not sure how PS1 gets overwritten by this, but it does. Commenting out Drush's superfluous customization makes the problem go away. Thanks to @terdon.






    share|improve this answer

























      up vote
      0
      down vote













      Checked $PROMPT_COMMAND as advised by @terdon:



      user@ubuntu ~ $ echo $PROMPT_COMMAND
      __git_ps1 "u@h w" "$(__drush_ps1 "[%s]") \$ "


      Then looked harder at .bashrc and found:



      # Include Drush prompt customizations.
      if [ -f "/home/user/.drush/drush.prompt.sh" ] ; then
      source /home/user/.drush/drush.prompt.sh
      fi


      Drush was setting its own $PROMPT_COMMAND, apparently instead of PS1. Not sure how PS1 gets overwritten by this, but it does. Commenting out Drush's superfluous customization makes the problem go away. Thanks to @terdon.






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        Checked $PROMPT_COMMAND as advised by @terdon:



        user@ubuntu ~ $ echo $PROMPT_COMMAND
        __git_ps1 "u@h w" "$(__drush_ps1 "[%s]") \$ "


        Then looked harder at .bashrc and found:



        # Include Drush prompt customizations.
        if [ -f "/home/user/.drush/drush.prompt.sh" ] ; then
        source /home/user/.drush/drush.prompt.sh
        fi


        Drush was setting its own $PROMPT_COMMAND, apparently instead of PS1. Not sure how PS1 gets overwritten by this, but it does. Commenting out Drush's superfluous customization makes the problem go away. Thanks to @terdon.






        share|improve this answer












        Checked $PROMPT_COMMAND as advised by @terdon:



        user@ubuntu ~ $ echo $PROMPT_COMMAND
        __git_ps1 "u@h w" "$(__drush_ps1 "[%s]") \$ "


        Then looked harder at .bashrc and found:



        # Include Drush prompt customizations.
        if [ -f "/home/user/.drush/drush.prompt.sh" ] ; then
        source /home/user/.drush/drush.prompt.sh
        fi


        Drush was setting its own $PROMPT_COMMAND, apparently instead of PS1. Not sure how PS1 gets overwritten by this, but it does. Commenting out Drush's superfluous customization makes the problem go away. Thanks to @terdon.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 29 at 2:27









        Sqerstet

        183211




        183211






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1096867%2fcannot-export-ps1-over-ssh%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Category:香港粉麵

            List *all* the tuples!

            Channel [V]