[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash is executing command at the prompt when closing
From: |
Chet Ramey |
Subject: |
Re: bash is executing command at the prompt when closing |
Date: |
Sun, 25 Mar 2007 18:54:42 -0400 |
User-agent: |
Thunderbird 1.5.0.10 (Macintosh/20070221) |
doktor5000@arcor.de wrote:
> Bash Version: 3.1
> Patch Level: 17
> Release Status: release
>
> Description:
> Please see mandriva bugreport for a more detailed explanation
> with examples at: http://qa.mandriva.com/show_bug.cgi?id=21708
>
> The problem is that bash always executes the command at the prompt
> when closing the terminal window.
>
> Repeat-By:
> Open up a terminal emulator,
> (i use konsole for that, but it works also with rxvt)
> use "su" to get root. Enter a command, which is normally
> only available to root (i used rpmdrake for that)
> DO NOT press enter, but quit the terminal by clicking
> on the exit button.
> The command which was at the prompt will be executed.
This is not an error -- readline and the shell read EOF when this happens,
not an error from read. Readline returns the line to the application,
without executing any function bound to accept-line.
> Alternative method:
>
> create a text file with a command, but NO return at the end.
>
> echo -n ls > testfile
> chmod 700 testfile
> ./testfile
> you'll find your command has been executed.
EOF delimits a token; it is not an error condition. If the delimited
token is sufficient to complete a command, the command is considered
parsed and subsequently executed. All shells I looked at behave this
way.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Live Strong. No day but today.
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/