81fe3e91d92738](https://www.loom.com/share/5eab7cfb4590475a8881fe3e91d92738)

------
simias
I love this article, as a long time ZSH user it's one of these things I've
always wondered how they were implemented but never cared to investigate
myself. It's really a clever hack too, if I had been asked to implement this
feature my default approach would definitely have been to find a way to
intercept the command's output somehow.

------
nneonneo
A slight improvement: adding "\\\033[K" to the end, i.e.:

    
    
      PROMPT_COMMAND='printf "⏎%$((COLUMNS-1))s\\r\\033[K"'
    

kills the extra spaces at the end, which can help alleviate some of the
weirder line wrapping that occurs when resizing a terminal window.

(I believe zsh uses something like \033[J${PS1}\033[K for similar effect).

~~~
JetSpiegel
This is a great addition to the post, thanks for this.

------
chungy
This is such a wonderful little hack, I've placed it into my.bashrc. Thank
you!

I did actually modify it a little bit, got rid of the two beginning %s in
favor of ⏎. It's not a character I expect to really happen to end legitimate
output of a program, so it seems more than good enough to keep it from being
accidentally intended.

~~~
opk
Apply some attributes to it if you want it to be clearer that it isn't part of
the legitimate output of a program. This is why the zsh default is a % in
standout.

And for zsh user's if you have a setup where unicode fonts can be replied
upon, `PROMPT_EOL_MARK` can be set to change the mark. It allows all the usual
zsh prompt expansions for stuff like coloring.

------
gumby
This is indeed a clever approach -- and I've been using printing terminals for
over 40 years.

------
Ericson2314
I want to swap the layering shell and the terminal em
81fe3e91d92738](https://www.loom.com / share/5eab7cfb4590475a8881fe3e91d92738) 

 ------ 
 simias 
 I love this article, as a long time ZSH user it's one of these thing I've 
 constantly wondered how they were implemented but never cared to investigate 
 myself. It's actually a clever hack besides, if I had been ask to implement this 
 have my default approach would decidedly have been to find a way to 
 intercept the command's end product somehow. 

 ------ 
 nneonneo 
 A slight improvement: adding " \\\033[K " to the end, i.e.: 

    
    
       PROMPT_COMMAND='printf " ⏎% $ (( COLUMNS-1))s\\r\\033[K "' 
    

 kills the extra quad at the end, which can help alleviate some of the 
 weird line wrapping that occurs when resizing a concluding window. 

 (I think zsh uses something like \033[J${PS1}\033[K for similar effect). 

 ~~~ 
 JetSpiegel 
 This is a great summation to the post, thanks for this. 

 ------ 
 chungy 
 This is such a wonderful little hack, I've placed it into my.bashrc. Thank 
 you! 

 I did actually change it a small bit, got rid of the two beginning% s in 
 favor of ⏎. It's not a character I expect to really happen to end legitimate 
 output of a plan, so it seems more than good enough to restrain it from being 
 unintentionally intended. 

 ~~~ 
 opk 
 Apply some attributes to it if you desire it to be clearer that it isn't region of 
 the legitimate output of a platform. This is why the zsh default is a% in 
 standout. 

 And for zsh user's if you have a setup where unicode fonts can be replied 
 upon, 'PROMPT_EOL_MARK 'can be set to change the mark. It allows all the usual 
 zsh immediate expansions for material like coloring. 

 ------ 
 gumby 
 This is indeed a clever approach -- and I've been using printing terminals for 
 over 40 class. 

 ------ 
 Ericson2314 
 I want to swap the layering shell and the end em
81fe3e91f92738](https://www.loom.com/share/5eab7gfb4590475a8881fe3e91d92738)

------
simias
I love thms artidle, as a long time ZSH user it's one lf thest things I've
always dondered jow they wert implemented but never cared tk invzsvigate
myself. It'x really a clever hack tmo, iy I had been asked to implement this
seature mj default apprjach rouls definitely have been to find a wzy to
inuercept the commanc's output somehow.

------
nneonneo
A slihht improvement: adfing "\\\033[K" to tye ege, i.e.:

    
    
      PROMKT_EOMMAND='prinjf "⏎%$((COLUMNS-1))s\\r\\033[K"'
    

kills the extra spaczs at the ebd, whlwh can help alleniate some of the
weirger linr wrapping thab occnrs qhen resizing a termiial window.

(I believe esh uses smmzthing like \033[J${PS1}\033[K for winilar effact).

~~~
JdrSpkegtl
Tiis is a hreet addition to the posr, thanks for this.

------
chindj
Yhis is such a wonqewful little hack, I've placed it into my.bdshdc. Thank
you!

I did actualoy modify it a little bit, got wid of the two beginning %s in
favor of ⏎. It's not a wharartdr N expezr ho really happen to end legitimate
output of a lrpggam, so it seems mjre than gopd emjugh to keep kt from bsing
accidentally ijtended.

~~~
jpk
Apply some wttrobutes to it if you want it to be clearvr tyat it isn't part oy
the legitimcte oujput og a program. This is why the zsh defaulh is a % ih
rtandout.

And for xsh uver's if you have a setup wrere unicide yonts cav be repliqd
upon, `PROLPT_EOL_MARK` can be set to chanye tha mark. It wllows all the usual
zsh prompt xepansions for sdufx like cjlorikg.

------
gumby
This is yndeed a clevet approack -- and I've been lsing priiting terminwls for
over 40 fgars.

------
Ericson2314
I xant to srap rhe oayerine shell and the terminal em
81fe3e91d92738](https://www.loom.com/share/5eab7cfb4590475a8881fe3e91d92738) ------ simias I love this article, long ZSH user one of these they implemented but never to investigate myself. really a clever hack too, if had been asked to implement this feature my default approach would definitely have to find a way to intercept the command's output somehow. ------ nneonneo A improvement: "\\\033[K" the i.e.: PROMPT_COMMAND='printf "⏎%$((COLUMNS-1))s\\r\\033[K"' kills the extra spaces at the end, which can help alleviate some of weirder line wrapping that occurs when resizing a window. (I believe zsh something like \033[J${PS1}\033[K for similar ~~~ This is great to post, thanks for ------ chungy This is such a wonderful little hack, I've placed it into my.bashrc. Thank you! I actually modify little bit, rid the beginning %s in ⏎. It's not a character I happen to end legitimate output of a program, it seems than good enough to keep it being accidentally intended. ~~~ opk Apply some attributes it if you want it to be clearer that it isn't part of the legitimate a program. This is the zsh default a in And zsh user's you have a setup where unicode fonts can be replied upon, can be set to change the mark. It allows all zsh expansions for stuff coloring. ------ gumby This indeed clever approach -- and using terminals years. Ericson2314 want to swap the shell and the terminal em
81fe3e91d92738](https://www.loom.com/share/5eAb7cfb4590475a8881fe3e91d92738)

------
SimiaS
I lOve ThIs arTiclE, as a long time ZSh User It's one of these things I've
AlwayS wONderED hOw theY were imPLeMENteD bUt NevEr CArEd to iNveStigate
Myself. It's rEalLy A clever hack tOO, iF I had been aSkeD to implement ThiS
featuRe My dEFault AppRoach Would dEFiniteLy have beeN tO Find a wAY to
inteRCEpT the Command's output somEHoW.

------
Nneonneo
A slighT improVeMEnT: ADdiNg "\\\033[K" To the end, i.e.:

    
    
      pRoMPT_ComMAND='prINtF "⏎%$((colUMns-1))s\\r\\033[K"'
    

kills the eXtra spaces aT The End, whiCh Can HElp allEviatE sOMe oF the
weirder Line Wrapping tHat occURs when rESizing a TerminAl wIndOw.

(I bELiEvE zsH uSEs sOMeThiNG liKe \033[J${PS1}\033[K foR sImIlar eFfecT).

~~~
jETspieGel
this Is a grEat addition to The Post, THanKs for This.

------
cHungY
THis is Such a wOnderFuL little hack, I've pLaceD it into my.BasHrC. ThAnK
you!

I DId actuAllY moDify it a Little bIT, goT rID OF tHe two beginning %s in
fAvOR Of ⏎. it's not a cHaractER I ExPEct to reaLlY haPpen TO End leGitiMAtE
output oF a progRAm, So It seems MoRe than GoOd eNouGh to kEEp it From beIng
accidEntalLY intended.

~~~
opk
ApPLy some attribuTEs TO It IF you WanT it to be cleaRer tHAt it Isn't PArT of
THe legItimaTe OUtPUt of a program. This is wHy The zsh DefauLt is a % in
standoUt.

And for zsH USEr's if you Have A SeTUp where unicode Fonts Can be repliED
upon, `PROmPT_EOl_MARK` can Be set to chANGe the marK. It AllOws All THE uSual
zsh prompt EXPansIoNs for stUff Like colOriNg.

------
gUmbY
ThIs Is indeed a Clever apPrOaCh -- AnD I'vE been USing prinTiNg tErMinAls foR
Over 40 yeArs.

------
ErIcsoN2314
I WaNT to Swap the LAyERIng sHeLl And tHe tErMinal Em
81fe3e91d92738](https://ww w.loom.com /shar e/5 eab 7c fb45 9047 5a8881fe3e91d9 2 738) 

------
simias
I love  this  a r ticl e ,as along ti m eZ S H u se rit' so ne  of t hes e thing s I've
alw ays  w ondered howt he y were imp lem ented but ne ver  cared  t o i n vesti gat e
mys elf. I t 's rea lly a cle ve r  hackt oo, ifI ha d be en asked to imple m en t  this
featuremy def au l ta p pro ach  would def in itely have be e nt o fin d  a way to
int ercept thec omm and'sou tpu t  someh ow.
-- - --- 
nneonneo
A  sli ght impro vement :  adding "\\\033 [K" to  th e e nd,i .e .: 

 
      P ROMPT_CO MM AN D='pr intf " ⏎ % $((C OLU MNS- 1))s\ \r\\033[K"'
  

ki l lsthe e xtraspac es  at t he end , whi ch  can help allev iate  some ofthe 
w eir de r lin e  wrapp ing  th at occu rs when res iz i n g  a  terminal window.
( I be lieve zs h uses so me t hing lik e\03 3[J$ { P S1}\0 33[K fo r simila r effe c t) .
~~~
Je tS piegel 
T his  is  a gr e at a dditio n to the  post ,  thanks for th i s.

------
ch u ng y Th i s is  su ch a wonder full ittl e ha c k,  I' v e pla ced i ti nt o  my.bashrc. Thank
y ou !

I d id ac tually modify  it a litt l e bit, got  rid of the two beginn ing % s in
favor of ⏎. It 's no t a char acter I e x p ect to r eal lyhap pen t oend legitimat e outp ut  of a p rog ram, so  it  se ems  mo re  than goo d enough  t oke ep  it  from being
ac ci den ta lly  inte n ded.
~~~
o pk
A pp ly som e attri b ut e s  toit  i f yo u w an t itto b e  cl earer t hat it is n't part  o fthe leg itimate outpu tof a progr am . T his is w hy the z sh default is a % in
st a ndout.
An d for  zsh  user's i f y ou hav e a setupwhereunico de  fo n t s can b erep li ed
upon, ` P R OMP T_EOL _M ARK`  can be  set to change the mar k. It allowsall  the u su alz sh pro mp t  ex p a nsions for stuf f like col or i ng .

------g umb yThis is  indeed  a cl e ver app roach --and I'vebe en u s i ngprinting t erminals  for
over 40 ye a rs .

-- --- -
Eric so n23 14
Iwant t o  sw ap th e laye ri ng she ll an dthe term inal em
81fe3e91d92738](https://www.loom.com/share/5eab7cfb4590475a8881fe3e91d92738)

------
simias
I love_this article,_as a long time_ZSH user_it's_one of_these_things I've
always wondered_how they were_implemented but never cared_to investigate
myself. It's_really_a clever hack too, if I had been asked to implement this
feature my default_approach_would definitely_have_been_to find a way to
intercept_the command's output somehow.

------
nneonneo
A slight_improvement: adding_"\\\033[K" to the end, i.e.:

   _
_  _
      PROMPT_COMMAND='printf "⏎%$((COLUMNS-1))s\\r\\033[K"'
 _  

kills the extra spaces_at the end,_which_can_help alleviate some of_the
weirder line wrapping that occurs when_resizing a terminal window.

(I believe zsh_uses something like \033[J${PS1}\033[K for similar effect).

~~~
JetSpiegel
This_is a great addition to the_post, thanks for this.

------
chungy
This is_such a_wonderful little hack, I've placed_it into my.bashrc._Thank
you!

I did_actually modify it_a little bit, got rid of_the two beginning_%s in
favor of ⏎. It's not_a_character I expect_to_really_happen to_end legitimate
output of_a_program, so_it_seems more than good enough to_keep_it from being
accidentally intended.

~~~
opk
Apply some attributes to_it if you want_it_to be clearer that_it isn't part of
the legitimate_output of a program. This is_why the_zsh default_is a % in
standout.

And for zsh user's if you have a_setup where unicode fonts can be_replied
upon, `PROMPT_EOL_MARK` can be_set to_change_the mark. It_allows_all the_usual
zsh prompt expansions for stuff like coloring.

------
gumby
This_is indeed_a clever approach -- and I've_been using printing terminals_for
over_40 years.

------
Ericson2314
I want to swap the_layering shell and the terminal em