problems with a subshell in .profile

2009-10-17 Thread Nils
I use a shared .profile for bash and ksh93, I have a ksh93 specific
section which I want to separate through the following construct:

if ( test -n "${.sh.version}" ) 2>/dev/null; then
echo "ksh"
fi

bash just hangs while it works in POSIX shell and ksh93. A bash script
with above contents also works as expected.
Why is this?


another problem with bash PS1 handling

2009-10-17 Thread Nils
PS1='$( [ "${LOGNAME}" != root ] && color=green )'

works in ksh93 and POSIX shell but fails in bash as bash seems to
expand the "!" to the next history file number before doing command
substitution. Setting PS1='$( [ "${LOGNAME}" !!= root ] &&
color=green )' preserves the "!" and works in bash but fails in ksh93
and POSIX shell.


bash for AIX installp image

2009-10-17 Thread Perry Smith

Hi,

I hope I am not being a pest.  I compiled and uploaded bash 4.0 with  
patch level 033 this weekend.


The path to the base web site is http://aix-consulting.net

Enjoy,
Perry
Ease Software, Inc. ( http://www.easesoftware.com )

Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems







Re: "Sed" Question

2009-10-17 Thread Allodoxaphobia
On Wed, 14 Oct 2009 15:05:09 -0400, Greg Wooledge wrote:
> On Wed, Oct 14, 2009 at 12:24:30PM -0600, Bob Proulx wrote:
>> Pierre Gaston wrote:
>> > Please consider asking in a sed mailing list like:
>> > http://sed.sourceforge.net/#mailing
>> > or maybe in the usenet group comp.unix.shell
>> 
>> I would think help-gnu-ut...@gnu.org would be the better place to ask
>> for help about GNU utilities.  :-)
>
> We don't know that he's using GNU sed.

But, we do know it ain't a bash bug.




Re: Oddities when tab-completing filenames containing backticks

2009-10-17 Thread bash-bugs

2009/10/16 Chet Ramey :
> You need to remember that readline understands the characters in
> rl_completer_quote_characters as those which, in pairs, delimit quoted
> substrings in the line.  It performs completion (allowing the application
> to take first crack, of course) on the substring, using the text after
> the open quote.

Then it is a bug in readline that it is incapable of
properly handling nested quotes.

> The other thing to keep in mind is that readline doesn't look past point
> when performing completion -- it only considers characters from the
> beginning of the line or a quote character up to point.

If it considered characters from the beginning of the line,
then there would be no issue.  The backtick is inside an
open single quote, and the backtick is *not* a special
character under that circumstance -- it's no more special
to Bash than the letter "j" inside an open single quote.

> My answers below are for the built-in bash completion, not
> any programmable completions you might have defined.

I don't use any programmable completion, these are all stock,
and confirmed by other users of irc://irc.freenode.net/#bash

>> Repeat-By:
>>
>>1) '`  This causes all commands available on the system to be
>>listed such as `awk `bash etc., even though it's inside
>>single quotes.
>
> Readline does completion on substrings; it passes ` to the bash completion
> code, which performs command completion.

Again, a backtick is no more of a special character than the
letter "a" inside an open single quote.  This is incorrect
behaviour.

>>2) '`text  This completes the filename, but it does not insert a
>>trailing single quote as tab-completion would usually do.
>
> Bash receives "`text"

What do you mean by that?  Didn't you say Bash is sending
that to readline?

> does command completion on `text'

How would it do completion on something that isn't there?
I did not fill in a closing single quote.

> and suppresses the append of the close quote,
> since it's usually wrong in this case.

What appended closing quote, there is none?

If you go:

   # ls '/usr/bin/mpg3

You get the following:

   # ls '/usr/bin/mpg321'

But if you have a file called /tmp/`rubble.txt and go:

   # ls '/tmp/`rub

Then you get:

   # ls '/tmp/`rubble.txt

No closing single quote.  Incorrect and inconsistent
behaviour.  Inside single quotes, a backtick is no
different from any other character allowed in filenames,
including control characters, tabs, newlines, accented
letters, line-drawing characters, dashes, exclamation
points, etc.

Another example:

   # ls '/tmp/!rub

Completes as expected with the closing single quote for:

   # ls '/tmp/!rubble.txt'

The same goes for these filenames:

   # ls '/tmp/~test.txt'
   # ls '/tmp/"test.txt'
   # ls '/tmp/$test.txt'
   # ls '/tmp/-test.txt'
   # ls '/tmp/(test.txt'
   # ls '/tmp/&test.txt'

They all close the single quote.  The only one that
messes up is the filename beginning with a backtick.

>>3) '`dir   This completes the directory name and adds the trailing
>>forward slash, but not the trailing single quote.
>
> Again, appending the trailing single quote without the trailing ` is
> generally going to be wrong.

Please explain yourself.  Backticks *are not special* inside
single quotes.  Do you need a closing "h" if you have an
opening "h" in "hello world"?  No?  Then why would you need a
closing backtick which is just another normal character?  This
is obviously incorrect behaviour.

>>4) 'text`  This completes the filename and closes the single quote
>>as expected.
>
> Interesting.  I don't get this behavior.

This behaviour makes snese, because it is the correct
behaviour.  The other behaviour above is the incorrect
behaviour.  A backtick is *not* special to Bash from
inside single quotes.

>>5) '`text' When using tab-completion inside single quotes on a
>>filename beginning with a backtick, then it completes
>>the filename and adds an additional closing single quote,
>>e.g. '`filename.txt''
>
> Also interesting.  I get normal command completion without any closing
> quote appended.

Are you following my example exactly?  I'll provide
exact steps to reproduce, below.

Step 1:

   touch '/tmp/`example.txt'

Step 2:

   ls '/tmp/`exam'

Step 3:

   Place your cursor on top of the closing single quote,
   after the "m", and press 

Result:

   touch '/tmp/`example.txt''

Compare this to:

   touch '/tmp/example.txt'
   touch '/tmp/exam'
   touch '/tmp/example.txt'

Works as expected, no double-closing-single-quote.

>>6) '`dir'  When using tab-completion inside single quotes on a
>>directory name beginning with a backtick, then it
>>completes the directory name and adds an additional
>>closing single quote after the directory name an

bug-bash@gnu.org

2009-10-17 Thread Sitaram Chamarty
Hello,

When the previous command was backgrounded (say "gvim
filename.c &") and then you try some other command using
Alt-., it expands to "&" and not "filename.c".

Is this considered a bug?  Or correct behaviour that just
happens to be not useful in this specific case?

Thanks,

Sitaram





Prompt - cursor position - command history display problem

2009-10-17 Thread Timothy James Erlenmeyer


Configuration Information [Automatically generated, do not
change]:

Machine: x86_64

OS: linux-gnu

Compiler: gcc

Compilation
CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu'
-DCONF_MACHTYPE='x86_64-unknown-linux-gnu' -DCONF_VENDOR='unknown'
-DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H -I. -I. -I./include -I./lib -g -O2

uname output: Linux
cyclops4 2.6.21-1.3194.fc7 #1 SMP Wed May 23 22:47:07 EDT 2007 x86_64
x86_64 x86_64 GNU/Linux

Machine Type: x86_64-unknown-linux-gnu

Bash
Version: 4.0

Patch Level: 28

Release Status: release

Description:

With
a color prompt, long directory names, and/or long command lines, scrolling
through the command history often causes the cursor to be in the wrong
position, the prompt to loose color and remnants of previous long commands
to remain on the line with short commands.

Repeat-By:

* This line is
placed in ~/.bashrc:

PS1='[e[31;2m]w$[e[0m] '

* A terminal window is
opened with system default parameters (xterm and gnome-terminal have the
same behavior).

* xwininfo indicates that its geometry is: 80x24-80-85
(the window width changes the prompt-cursor-command line behavior).

*The
following is one of many sequences that cause the problem.

* The following
commands have been executed (prompts are shown here as the text from first
character to the first $) :

~$ pwd|wc -c

14 (*** response to
command*)

~$ mkdir -p
/tmp/Classification_Parameter_Estimation_and_State_Estimation_An_Engineering_Approach_Using_MATLAB/

~$
cd
/tmp/Classification_Parameter_Estimation_and_State_Estimation_An_Engineering_Approach_Using_MATLAB/

**
Now Command History is Scrolled Back With Up Arrow.
Result:

/tmp/Classification_Parameter_Estimation_and_State_Estimation_An_Engineering_Approach_Using_MATLAB$
pwd|wc -cwd|wc -c

99 (*** response to command*) Remnant of
another command line (above) --^