zsh-users
 help / color / mirror / code / Atom feed
* zsh script wipes out my PROMPT and RPROMPT
@ 1998-01-24 20:23 Timothy J Luoma
  1998-01-24 22:13 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Timothy J Luoma @ 1998-01-24 20:23 UTC (permalink / raw)
  To: zsh-users


This script wipes out the PROMPT and RPROMPT

This is for zsh 3.0.5 (both the script and my login shell)


#!/usr/local/bin/zsh -f

PATH=/Users/luomat/Unix/bin:/Users/luomat:/usr/local/gnu/bin:/usr/local/bin:/bin:/usr/ucb:/usr/bin:/usr/etc:/usr:/etc

TIME=`date +"%s"`

NAME=`basename $0`

FILE=${HOME}/.$NAME.$TIME

netstat -n 				|\
	fgrep ESTABLISHED 		|\
	fgrep -v '192.42.172.2'		|\
	awk '{print $4"\t\t"$5}' > $FILE

LINES=`wc -l $FILE | awk '{print $1}'`

for i in {1..$LINES}; do

	INFO=`cat -n $FILE |\
		sed 's/ *//g' |\
			grep -w "^$i" |\
				awk '{print $2" "$3}'`
	
	echo "Line $i: $INFO"	

done

echo "Here is the file:"
cat $FILE

rm -f $FILE

exit 0



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

* Re: zsh script wipes out my PROMPT and RPROMPT
  1998-01-24 20:23 zsh script wipes out my PROMPT and RPROMPT Timothy J Luoma
@ 1998-01-24 22:13 ` Bart Schaefer
  1998-01-24 22:29   ` Timothy J Luoma
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 1998-01-24 22:13 UTC (permalink / raw)
  To: Timothy J Luoma, zsh-users

On Jan 24,  3:23pm, Timothy J Luoma wrote:
} Subject: zsh script wipes out my PROMPT and RPROMPT
}
} This script wipes out the PROMPT and RPROMPT

Can you explain further, please?

If you run this as an actual script, it -shouldn't- be able to have any
effect on your prompt at all, because it runs in a second shell.

If you run this as a shell function (e.g. by autoloading it), the "exit 0"
at the end should kill the shell entirely.

If you source or execute as a function this script from your .zlogin or
other init file, the "exit 0" will abort reading that file, which will of
course leave unfinished anything that appears later in the file.  My guess
is that this is what you're seeing, and that if you get rid of "exit 0"
then things will improve.

Another problem is that

LINES=`wc -l $FILE | awk '{print $1}'`

is changing zsh's idea of the size of your terminal; LINES is a reserved
variable name, along with COLUMNS.  You shouldn't use it as a temporary.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: zsh script wipes out my PROMPT and RPROMPT
  1998-01-24 22:13 ` Bart Schaefer
@ 1998-01-24 22:29   ` Timothy J Luoma
  1998-01-24 22:52     ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Timothy J Luoma @ 1998-01-24 22:29 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

	Author:        "Bart Schaefer" <schaefer@brasslantern.com>
	Original-Date: Sat, 24 Jan 1998 14:13:39 -0800
	Message-ID:    <980124141339.ZM23464@candle.brasslantern.com>

> If you run this as an actual script, it -shouldn't- be able to have any
> effect on your prompt at all, because it runs in a second shell.

It is run as an actual script


> If you run this as a shell function (e.g. by autoloading it), the "exit 0"
> at the end should kill the shell entirely.

Nope, it is its own script, chmod 755


> Another problem is that
>
> LINES=`wc -l $FILE | awk '{print $1}'`

AH... I used another variable instead.

The behavior seems to have stopped.... I'm not sure why.... but since it  
shouldn't have happened anyway....

TjL


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

* Re: zsh script wipes out my PROMPT and RPROMPT
  1998-01-24 22:29   ` Timothy J Luoma
@ 1998-01-24 22:52     ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 1998-01-24 22:52 UTC (permalink / raw)
  To: Timothy J Luoma; +Cc: zsh-users

On Jan 24,  5:29pm, Timothy J Luoma wrote:
} Subject: Re: zsh script wipes out my PROMPT and RPROMPT
}
} > LINES=`wc -l $FILE | awk '{print $1}'`
} 
} AH... I used another variable instead.
} 
} The behavior seems to have stopped.... I'm not sure why.... but since it  
} shouldn't have happened anyway....

Could be that the zsh executing the script was improperly resetting the
tty driver's idea of the terminal dimensions when it saw the assignment
to LINES.  The parent zsh would then see the new tty configuration when
the script exited, and reset its own LINES.  If LINES became sufficiently
small, zle might decide that it couldn't draw a prompt, or some such.

There were a number of changes to zsh's tty-size handling in 3.0.5 that
I still think were bad ideas; in the face of too little information, I'd
rather that the shell did nothing, rather than reconfigure the tty based
on partial data that might be wrong.  However, I can't definitely point
to any particular bug (not even this one) that is directly attributable
to the new code.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

end of thread, other threads:[~1998-01-25 15:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-01-24 20:23 zsh script wipes out my PROMPT and RPROMPT Timothy J Luoma
1998-01-24 22:13 ` Bart Schaefer
1998-01-24 22:29   ` Timothy J Luoma
1998-01-24 22:52     ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).