3

I am using iTerm2 on MacOS Catalina . Here is my PS1 into ~/.bashrc , using a function ps1 :

function ps1 {
        # PROMPT SECTION
        BLUE='\[\033[0;34m\]'
        LIGHT_CYAN='\[\033[1;36m\]'
        DEFAULT='\[\033[0m\]'
        PURPLE='\[\033[0;35m\]'
        LIGHT_PURPLE='\[\033[1;35m\]'
        LIGHT_GREEN='\[\033[0;32m\]'
        PINK='\[\033\[0;31m\]'


        # \! - History number of last command
        # $? - Exit value of last command
        # \t - Exit time of last command
        # \w - Current directory (relative)

PS1="$PURPLE|$DEFAULT$LIGHT_GREEN\u@$DEFAULT$LIGHT_CYAN\h$DEFAULT$PURPLE|$DEFAULT\t$PURPLE|$DEFAULT$LIGHT_PURPLE\w$DEFAULT$PURPLE|$DEFAULT "
}

ps1

The issue happens when I have long path, it seeems to be broken on second or third line like this :

enter image description here

I tried to increase the number of columns (to 1000) into iTerm2 -> Preferences but it doesn't seem to fix this issue.

I can't see where the error comes from.

Anyone could see what's wrong ? Regards

  fab@astro|13:12:32|~/Phd_2019_2020/Travail_2_faire_varier_Omega_DE_sur_CAMB_et_regarder_si_les_P_k_changent_21_Octobre_2019/Main_Directory_Work/TSAF_lvl_up_Derivatives_15_points_on_Cl_stabilite_Code_is_surel
y_VALIDATED_for_15_points_derivatives_AND_After_trying_to_solve_the_pathologic_zone_1e-5_TO_1e-2_13_Novembre_2019/Test_FAIRE_VARIER_TOUS_LES_PARAMETRES_AVEC_les_2_pas_2e-2_et_1e-1_AVEC_Takabird_SECONDE_TENTATIVE_AVEC_LA_VAR        IATION_de_wde_EN_FLAT_DANS_Camb_launcher_6_DECEMBRE_2019/CAMB_der_3_pts/fortran|
  • 1
    Does the same thing happen in Terminal? – nohillside Dec 10 '19 at 5:36
  • @nohillside yes, same issue with Terminal but I don't want to use Terminal, iTerm2 is great. – youpilat13 Dec 10 '19 at 14:52
  • 1
    If the problem occurs both in Terminal and in iTerm it's probably something the shell does, not the terminal application. I didn't count the characters but does the line break occur after 256 characters (probably including any escape sequences)? – nohillside Dec 10 '19 at 14:57
  • Did some more tests: It's related to the coloring, without colors it works as expected. Also, it doesn't seem to depend on the width of the terminal window, the break always occurs in the third line. – nohillside Dec 11 '19 at 13:29
1
+50

It's a bug related to the old version of bash included in macOS.

To overcome you can

enter image description here

  • Thanks ! updating bash version fixed it . Regards – youpilat13 Dec 12 '19 at 7:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .