public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: odd bash wrapping due to ansi codes
@ 2000-09-19  6:46 Earnie Boyd
  0 siblings, 0 replies; 6+ messages in thread
From: Earnie Boyd @ 2000-09-19  6:46 UTC (permalink / raw)
  To: Chris Abbey, cygwin

--- Chris Abbey <cabbey@bresnanlink.net> wrote:
> 
> In which case I'd think the 'fi' element in my changed /etc/profile
> can move up one line:
> 

AISI,

> if [ "$SHELL" != "/bin/bash" ]; then
>      test -f ./.profile && . ./.profile
> fi

can be deleted from /etc/profile.  You only need

> test -f ./.bashrc && . ./.bashrc

Cheers,

=====
--- < http://earniesystems.safeshopper.com > ---
   Earnie Boyd: < mailto:earnie_boyd@yahoo.com >
            __Cygwin: POSIX on Windows__
Cygwin Newbies: < http://gw32.freeyellow.com/ >
           __Minimalist GNU for Windows__
    Mingw Home: < http://www.mingw.org/ >

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: odd bash wrapping due to ansi codes
@ 2000-09-25 17:10 Earnie Boyd
  0 siblings, 0 replies; 6+ messages in thread
From: Earnie Boyd @ 2000-09-25 17:10 UTC (permalink / raw)
  To: Chris Abbey; +Cc: cygwin users

--- Chris Abbey <cabbey@bresnanlink.net> wrote:
> At 06:46 9/19/00 -0700, you wrote:
> >AISI,
> >
> > > if [ "$SHELL" != "/bin/bash" ]; then
> > >      test -f ./.profile && . ./.profile
> > > fi
> >
> >can be deleted from /etc/profile.  You only need
> >
> > > test -f ./.bashrc && . ./.bashrc
> >
> >Cheers,
> 
> what about users of other shells? do not they need ~/.profile as well?
> 

Sorry, Chris, I just received this.

I'm not sure.  Bourne compliant shells are going to read /etc/profile but it
may be a matter of the implementation for the ~/.profile file.  Does anyone on
the list know the answer to Chris' question?

Cheers,

=====
--- < http://earniesystems.safeshopper.com > ---
   Earnie Boyd: < mailto:earnie_boyd@yahoo.com >
            __Cygwin: POSIX on Windows__
Cygwin Newbies: < http://gw32.freeyellow.com/ >
           __Minimalist GNU for Windows__
    Mingw Home: < http://www.mingw.org/ >

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: odd bash wrapping due to ansi codes
  2000-09-17  2:07 Chris Abbey
@ 2000-09-19  7:10 ` Robert Praetorius
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Praetorius @ 2000-09-19  7:10 UTC (permalink / raw)
  To: Chris Abbey; +Cc: cygwin

> '<0x1b>]0;\w<0x07><0x1b>[1m<0x1b>[34m\w<0x1b>[0m $ '

     I've found that bash is happier when I wrap ANSI (or ANSIesque) 
escape and control sequences inside \[ . . . \].  To quote from the 
bash man page:

          \[   begin a sequence of non-printing characters, which
               could be used to embed a terminal control sequence
               into the prompt
          \]   end a sequence of non-printing characters


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: odd bash wrapping due to ansi codes
  2000-09-18  5:40 Earnie Boyd
@ 2000-09-18 22:29 ` Chris Abbey
  0 siblings, 0 replies; 6+ messages in thread
From: Chris Abbey @ 2000-09-18 22:29 UTC (permalink / raw)
  To: cygwin

At 05:40 9/18/00 -0700, Earnie Boyd wrote:
>--- Chris Abbey <cabbey@bresnanlink.net> wrote:
> > if [ "$SHELL" != "/bin/bash" ]; then
> >       test -f ./.profile && . ./.profile
> >       test -f ./.bashrc && . ./.bashrc
> > fi
> >
> > this has the advantage for those who run bash of not
> > sourcing these files twice, as bash does so itself.
>
>No, it doesn't always.  If --login then ./.bashrc is not performed but
>./.profile is, and without --login ./.bashrc is performed but not ./.profile.
>Also, without --login the /etc/profile isn't performed and shouldn't be a
>concern.

ok, my head hurts now. This explains why when I forget that the
cmd shell I'm in didn't start from bash that bash looks wierd when
I start it....

iow in bash.exe:
if (args.contains("--login")) {
     source = {"/etc/profile", "~/.profile"};
} else {
     source = "~/.bashrc";
}

ANYWAY... the circumstance I'm concerned with was the default bash
shell that comes up when the user clicks on that funky little Cygwin
icon on their desktop. So '--login -i' are the arguments; in which
case the pattern is:

/etc/profile sources ~/.profile
/etc/profile sources ~/.bashrc
bash sources ~/.profile

(I guess since I don't have a ~/.bashrc I never noticed it
wasn't being run twice. ;)

In which case I'd think the 'fi' element in my changed /etc/profile
can move up one line:

if [ "$SHELL" != "/bin/bash" ]; then
     test -f ./.profile && . ./.profile
fi
test -f ./.bashrc && . ./.bashrc


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: odd bash wrapping due to ansi codes
@ 2000-09-18  5:40 Earnie Boyd
  2000-09-18 22:29 ` Chris Abbey
  0 siblings, 1 reply; 6+ messages in thread
From: Earnie Boyd @ 2000-09-18  5:40 UTC (permalink / raw)
  To: Chris Abbey, cygwin

--- Chris Abbey <cabbey@bresnanlink.net> wrote:
> 
> I've set mine up as:
> 
> if [ "$TERM" == "cygwin" ]; then
> 	PS1='' #cygwin version with ansi codes
> else
> 	PS1='\w $'
> fi
> export PS1
> 
> and as long as I'm in that file, I just saw the other
> patch I put in my copy....
> 
> if [ "$SHELL" != "/bin/bash" ]; then
> 	test -f ./.profile && . ./.profile
> 	test -f ./.bashrc && . ./.bashrc
> fi
> 
> this has the advantage for those who run bash of not
> sourcing these files twice, as bash does so itself.
> 

No, it doesn't always.  If --login then ./.bashrc is not performed but
./.profile is, and without --login ./.bashrc is performed but not ./.profile. 
Also, without --login the /etc/profile isn't performed and shouldn't be a
concern.

Cheers,

=====
--- < http://earniesystems.safeshopper.com > ---
   Earnie Boyd: < mailto:earnie_boyd@yahoo.com >
            __Cygwin: POSIX on Windows__
Cygwin Newbies: < http://gw32.freeyellow.com/ >
           __Minimalist GNU for Windows__
    Mingw Home: < http://www.mingw.org/ >

__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* odd bash wrapping due to ansi codes
@ 2000-09-17  2:07 Chris Abbey
  2000-09-19  7:10 ` Robert Praetorius
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Abbey @ 2000-09-17  2:07 UTC (permalink / raw)
  To: cygwin

environment is a clean install of 1.1.4 from the "latest"
as of 7 Sept, window is set to 132 columns wide, $COLUMNS is
also set to 132. PS1 is set to:
'<0x1b>]0;\w<0x07><0x1b>[1m<0x1b>[34m\w<0x1b>[0m $ '

cd /tmp
mkdir -p 
one/two/three/four/five/six/seven/eight/nine/ten/eleven/twelve/thirteen/fourteen/fifteen/sixteen/seventeen/eighteen/nineteen/twenty/twentyone/

{wrapping bug #1: mkdir command is wrapped between x and t of sixteen,
at column 110}

cd one/
cd two/
cd ...

repeating this by means of: "up arrow, esc, backspace, tab, enter"

after cd ten you'll see wrapping bug #1b,
   command is wrapped at column 61

after cd eleven you'll see wrapping bug #2,
   prompt is wrapped at column 58

each cd after that you'll see the prompt is
   wrapped *earlier* than before

until after cd eighteen, when it tries to wrap at
   a negative column and the result is some binary
   looking junk in the prompt. This is also the point
   where the titlebar stops being in sync; it appears
   that from here forward each prompt begins with the
   trailing junk that's been truncated from the titlebar.

if the titlebar manipulations are removed from PS1 then
everything goes well up until cd eighteen and nineteen,
where there are some issue with crlfs being left out, but
once you get past there then the prompt is properly wrapped
and everything is ok.

if all ansi codes are removed (PS1='\w $') then there are
no problems at all.



On a related note:

the default /etc/profile sets up these ansi codes by
default for all terminals, I'd suggest that at the bare
minimum these be skipped if the term type is incapable.

I've set mine up as:

if [ "$TERM" == "cygwin" ]; then
	PS1='' #cygwin version with ansi codes
else
	PS1='\w $'
fi
export PS1

and as long as I'm in that file, I just saw the other
patch I put in my copy....

if [ "$SHELL" != "/bin/bash" ]; then
	test -f ./.profile && . ./.profile
	test -f ./.bashrc && . ./.bashrc
fi

this has the advantage for those who run bash of not
sourcing these files twice, as bash does so itself.


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2000-09-25 17:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-19  6:46 odd bash wrapping due to ansi codes Earnie Boyd
  -- strict thread matches above, loose matches on Subject: below --
2000-09-25 17:10 Earnie Boyd
2000-09-18  5:40 Earnie Boyd
2000-09-18 22:29 ` Chris Abbey
2000-09-17  2:07 Chris Abbey
2000-09-19  7:10 ` Robert Praetorius

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).