Re: What is the difference between a newline and a semi-colon?

2014-05-30 Thread Andreas Schwab
Bruce Korb writes: > Thanks, Eric & Chet. I hope nobody ever needs to load up a set of > aliases within a Makefile script. A non-interactive shell does not have aliases. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5

Re: Arithmetic + array allows for code injection

2014-06-02 Thread Andreas Schwab
ror token is "$(date)") > > That also looks OK. Here the index is '$x'. Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: Arithmetic + array allows for code injection

2014-06-02 Thread Andreas Schwab
If you want to write robust scripts, don't use shell. Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: 'time' not recognized as reserved when first word after 'if'

2014-06-10 Thread Andreas Schwab
ot; which appears as a component in > the definitions of "pipeline", "list", and "complex command". A command can be either a simple command, a compound command, or a function definition, but not a pipeline or a list. Andreas. -- Andreas Schwab, SUSE Labs, sch

Re: Code for :"Re: HERE document failed && Re: /dev/fd/62: No such file or directory"

2014-07-29 Thread Andreas Schwab
r for your memory storage. Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: Bug or feature: Why does Bash's "printf" define global variables?

2014-08-03 Thread Andreas Schwab
Tim Friske writes: > my assumption was that Bash's "printf" builtin implicitly defines a local > variable when used inside a function like so: Why? A simple assignment doesn't either, and that's what printf does in the end. Andreas. -- Andreas Schwab

Re: Feature request - ganged file test switches

2014-08-09 Thread Andreas Schwab
[[ -r foo ]] && [[ -x foo ]] ; then . . . > > but > > if [[ -drx foo ]] ; then . . . > > is a lot easier. But it is ambigous. Does it mean adjuntion or conjunction? Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 4

Re: "echo" does not follow the "getopt" convention

2014-08-19 Thread Andreas Schwab
shall be recognized as a string operand. It also says: New applications are encouraged to use printf instead of echo. Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: Feature request: Add "import" built-in.

2014-08-24 Thread Andreas Schwab
Tim Friske writes: > set -- "${@:2}" Aka shift. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."

Re: Not so useless use of cat

2014-09-17 Thread Andreas Schwab
grams that open the files themselves. It cannot emulate "foo -o /dev/stdin" to make it the same as "foo >/dev/stdin". Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: Bash-4.3 Official Patch 25

2014-09-25 Thread Andreas Schwab
> tty uses stdin, so this is the expected output. Why do you think this has anything to do with this patch? $ tty --help | head -n 2 Usage: tty [OPTION]... Print the file name of the terminal connected to standard input. Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key finger

Re: File dtae comparison

2006-03-16 Thread Andreas Schwab
e file was not modified last hour, I want to send an email out to the > programmer. Any suggestions on the best way to do this? if test -n "$(find stampfile -mmin +60)"; then alarm fi Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraß

Re: File dtae comparison

2006-03-16 Thread Andreas Schwab
trojan30 <[EMAIL PROTECTED]> writes: > Thank you for your repley. One question, does the alarm command only work on > the machine it is run on? alarm is the command you write to send the mail. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Max

Re: echo "enhancement" leads to confused legacy script tools...

2006-03-20 Thread Andreas Schwab
Paul Eggert <[EMAIL PROTECTED]> writes: > Hence Bash can interpret \123 as an octal escape as well, if it so > chooses, and still conform to POSIX+XSI. But note that bash interprets -n as an option, which is not compliant with XSI. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PRO

Re: echo "enhancement" leads to confused legacy script tools...

2006-03-20 Thread Andreas Schwab
Paul Eggert <[EMAIL PROTECTED]> writes: > Andreas Schwab <[EMAIL PROTECTED]> writes: > >> But note that bash interprets -n as an option, which is not compliant with >> XSI. > > Bash doesn't claim conformance to XSI, so that's OK as far as Bash is >

Re: bash-3.1.011 escaped character error

2006-03-23 Thread Andreas Schwab
Mihai Barbos <[EMAIL PROTECTED]> writes: > When IFS is "\n" a single n at the end of a line is dropped. IFS="\n" is equivalent to IFS=n If you want to set IFS to a single newline character use either IFS=$'\n' or IFS=" " Andreas. --

Re: echo "enhancement" leads to confused legacy script tools...

2006-03-23 Thread Andreas Schwab
other use of the backslash results in implementation defined behaviour. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "An

Re: Keybinding "yank 0th arg", "delete backward argument"

2006-03-23 Thread Andreas Schwab
yank-0th-arg should insert /usr/local/bin/perl into the buffer. M-0 M-. (digit-argument yank-last-arg) > (2) delete-backward-argument, similar to delete-backward-word, but > should delete everything > to the left until the first white space. C-w (unix-word-rubout) Andreas. -- Andreas S

Re: Backquote Mystery

2006-03-27 Thread Andreas Schwab
"Com MN PG P E B Consultant 3" <[EMAIL PROTECTED]> writes: > Wenn you now do echo $e, you should get the following output: Try echo "$e". Then read about Word Splitting in the Bash manual. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux P

Re: i/o redirection into variables

2006-03-28 Thread Andreas Schwab
; > Is this generally possible? exec 3>&1 stderr=$(command 2>&1 >&3) exec 3>&- Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53

Re: `if $(cmd);' is a positive when there's no output from cmd

2006-04-15 Thread Andreas Schwab
nificance any more once the command is parsed, just like shell meta characters resulting from expansions are taken literally. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 175

Re: `if $(cmd);' is a positive when there's no output from cmd

2006-04-16 Thread Andreas Schwab
Herculano Einloft <[EMAIL PROTECTED]> writes: > Em (02:25:11), Andreas Schwab escreveu: > >> >>> Hey all, >>> >>> $ if $(echo string >/dev/null); then echo true; fi >>> true >>> >>> This should be a syntax error

Re: Bash-3.1.17 gets lost looking for end of string in certain contexts

2006-05-04 Thread Andreas Schwab
.script: line 608: syntax error: unexpected end of file That has already been fixed. > > The offending lines (602 thru 607) from spencer1.script are: The offending line is actually this: status=`echo '-'| { ${GREP} -E -e 'a\' >/dev/null 2>&1 ; echo $?;

Re: trap documentation does not match trap behavior

2006-05-11 Thread Andreas Schwab
trap '' TERM > /usr/sbin/crond -l8 This will run crond with SIGTERM set to SIG_IGN. > Fix: > Remove that sentence from the documentation? It's not wrong, just incomplete. See <http://www.opengroup.org/onlinepubs/009695399/utilities/trap.html>

Re: two process writing simultaneously

2006-06-18 Thread Andreas Schwab
different > locations on the screen ( 1 and 2)? I'd like to combine the output of > a repeating pstree command with an strace at the same time. Redirect the output of pstree and strace to different windows inside screen(1). Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuS

Re: terminating lines with accidental eof

2006-07-05 Thread Andreas Schwab
. Only in icanon mode, otherwise it's readline that does the processing. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now fo

Re: The yank-last-arg ("_") command and comments

2006-07-07 Thread Andreas Schwab
Thomas Mellman <[EMAIL PROTECTED]> writes: > A recent new version of bash has changed the behavior of the > yank-last-arg command ("_"). Is there a way to revert to the old behavior? histchars='!^ ' ie. disable the history comment character. Andreas. -- A

Re: Python and Bash

2006-07-20 Thread Andreas Schwab
"Andrew Kezys" <[EMAIL PROTECTED]> writes: > Is there any command that will kill bash script-assosciated processes > in a kind way (ie ctrl-c) when the overall script is ended? Use a trap on EXIT to do any cleanup you need. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL

Re: PATH and $0

2006-08-12 Thread Andreas Schwab
:" into only "/bin"). > > Negative. In bash "/bin:" is "/bin" and "." for PATH lookup. The point is that word splitting does not preserve the empty element at the end, thus it differs from PATH lookup. $ (PATH=/bin:; IFS=:; for x in $PATH; do e

Re: why doesn't this error message go to the bit bucket?

2006-08-28 Thread Andreas Schwab
RLIST, because the standard error was duplicated as standard output before the standard output was redirected to DIRLIST. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B

Re: incorrect brace expansion when using default values

2006-09-06 Thread Andreas Schwab
ion doesn't come into play here, because the braces are quoted. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED

Re: set -e vs. !

2006-09-08 Thread Andreas Schwab
Dan Jacobson <[EMAIL PROTECTED]> writes: > $ cat t.sh > set -ex > ! true #should stop here but doesn't!?! RTFM. `-e' Exit immediately if ..., unless ... the command's return status is being inverted using `!'. Andreas. -- Andreas

Re: read command and ascii null as delimiter

2006-09-11 Thread Andreas Schwab
r feature? > > $bash --version > GNU bash, version 2.05b.0(1)-release (i386-pc-linux-gnu) > Copyright (C) 2002 Free Software Foundation, Inc. > > $printf 'hello\0there' | { read -d$'\0'; echo $REPLY ; } ^^^ This is equiv

Re: Fatal bug with redirection

2006-10-04 Thread Andreas Schwab
just receives a SIGPIPE, since the process in the process substitution exits without consuming its input. If you are lucky the first echo will be faster... Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprin

Re: case statement breaks $( ) substitution

2006-10-06 Thread Andreas Schwab
[EMAIL PROTECTED] writes: > $ echo $( > > case a in > > 1) :;; > bash: syntax error near unexpected token `;;' Use (1) instead. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 9040

Re: Curly braces expansion not always works as expected.

2006-10-06 Thread Andreas Schwab
mwoehlke <[EMAIL PROTECTED]> writes: > ...but doesn't that mean that '{"x,x"}' should expand as '{x,x}' It does. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key

Re: Curly braces expansion not always works as expected.

2006-10-06 Thread Andreas Schwab
mwoehlke <[EMAIL PROTECTED]> writes: > Andreas Schwab wrote: >> mwoehlke <[EMAIL PROTECTED]> writes: >> >>> ...but doesn't that mean that '{"x,x"}' should expand as '{x,x}' >> >> It does. > > Huh? In th

Re: Tilde expansion not performed during variable evaluation

2006-10-11 Thread Andreas Schwab
Karen Etheridge <[EMAIL PROTECTED]> writes: > Tilde expansion is not being performed when variables are being evaluated. This is how it is supposed to be. Tilde expansion is performed before parameter expansion, as described in the manual. Andreas. -- Andreas Schwab, SuSE Lab

Re: logout from interactive subshell

2006-10-12 Thread Andreas Schwab
27;m two subshells deep >DO STILL MORE STUFF ># Now I want to exit >exit >exit >logout > > I would like to have a (interactive) command which does the final two > exits plus > a logout for me. exec cleartool Andreas. -- Andreas Schwab, SuSE Lab

Re: logout from interactive subshell

2006-10-12 Thread Andreas Schwab
"Com MN PG P E B Consultant 3" <[EMAIL PROTECTED]> writes: > I can't use traps here, because I know only at "exit time", whether > I want to logout completely, or just go up one level. $ call_and_exit() { "$@"; if test $? -eq 42; then exit; fi; } $

Re: bash 3.2 match operator problem

2006-10-12 Thread Andreas Schwab
`([' > testcase: line 6: `[[ "${OLDCANDIDATE}" =~ > ([^-]+)-([^-]+)-([^-]+)-0*([1-9][0-9]*)\.tgz ]]' Parens are special inside [[ ]], you need to quote them. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerp

Re: ulimit -c for core dumps

2006-10-20 Thread Andreas Schwab
is zero. Otherwise it will be truncated at the specified limit, but that does not count holes. The core file is probable pretty sparse; try running du on it. In any case this has nothing to do with the shell. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, M

Re: Spaces in args, escapes, and command substitution

2006-10-24 Thread Andreas Schwab
t; outputs newline-delimited result then surely there > should it should be possibly to have the spaces on each line escaped > and only the newlines converted to spaces. Word splitting is controlled by IFS. Use IFS=$'\n' to only split on newlines. Andreas. -- Andreas Schwa

Re: read builtin oddity/bug in bash 3.2?

2006-10-26 Thread Andreas Schwab
; produces the expected output of '[w]', Try the same while in /usr/bin. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214

Re: mkfifo and tee within a function

2006-11-28 Thread Andreas Schwab
all depends on timing. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something com

Re: NOT changing global variables

2006-12-29 Thread Andreas Schwab
displays the changed var1 as being 1. At the > expense of losing the return value. You are not using the return value of the function but its output. The return value of a function is the exit status of the last executed command, and can also be set with return. The return value is a

Re: Bash - various feature requests

2006-12-29 Thread Andreas Schwab
t; is used as an offset from the end of the value of parameter." > > However, if I use echo ${f:-3} I don't get the expected result. Read the second last sentence of the paragraph. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfe

Re: Open file descriptors

2007-01-18 Thread Andreas Schwab
Richard Ray <[EMAIL PROTECTED]> writes: > Other than lsof is there a way to determine what file descriptors are > open? $ (exec 4<&$n) 2>/dev/null && echo fd $n is open Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstr

Re: nocaseglob

2007-01-20 Thread Andreas Schwab
Bruce Korb <[EMAIL PROTECTED]> writes: > $ echo tpdsrc/umod/nodesvr/test/[a-z]* > tpdsrc/umod/nodesvr/test/Makefile tpdsrc/umod/nodesvr/test/SCCS > tpdsrc/umod/node > > What are the "Makefile" and "SCCS" entries doing on the line? Please read the Bash

Re: help me with readline key binding problem

2007-01-21 Thread Andreas Schwab
ing-of-line > bind -p returns the carbon copy of these two lines, You have just bound the two character sequences C-\ . and C-\ , to beginning-of-line. > but holding down Ctrl-. or , returns nothing. As long as the terminal does not emit anything distinguishable for these keys it won't

Re: nocaseglob

2007-01-23 Thread Andreas Schwab
uses strcoll as well. Most likely python has its own implementation which gets it wrong. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now

Re: bash gets confused by ANSI sequences

2007-01-27 Thread Andreas Schwab
Elmar Stellnberger <[EMAIL PROTECTED]> writes: > This bug has already been reported for konsole under bugs.kde.org, > bug#Bug 48109 <http://bugs.kde.org/show_bug.cgi?id=48109> Read <ftp://ftp.cwru.edu/pub/bash/FAQ>, question E3. Andreas. -- Andreas Schwab, SuSE Labs

Re: bash-3.2 regression: breaked colour prompt.

2007-02-24 Thread Andreas Schwab
ecked this behavior and in xterm everything works. Thus seems > that this is konsole bug and bash works as it should. Except that is also fails in xterm, or any other terminal. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Ger

Re: bush-3.2 regression: breaked colour prompt.

2007-02-24 Thread Andreas Schwab
Chet Ramey <[EMAIL PROTECTED]> writes: > I can't reproduce this on Mac OS X, using Terminal or xterm. I can reproduce it with GNU bash, version 3.2.9(1)-release (powerpc-apple-darwin8.8.0) both with Terminal and xterm. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECT

Re: while read subcommand problem

2007-03-02 Thread Andreas Schwab
sadvantage that generator and consumer no longer run concurrently. Process substitution does not have this problem. while ...; do var=...; done < <( generate-input-for-while ) use "$var" Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5

Re: documentation error in the FAQs

2007-03-03 Thread Andreas Schwab
ivalent to the command in the FAQ: IFS=. read A B C D < <(/usr/local/bin/ipaddr) This is actually more efficient since it avoids the extra command substitution. But both have the same outcome if the output of /usr/local/bin/ipaddr has no more than 4 dots. Andreas. -- Andreas Schwab, SuSE La

Re: signal propogation to backgrounded subshells

2007-03-06 Thread Andreas Schwab
cted. > Regardless, is there a simple solution to get the behavior I want? You need to enable job control and kill the whole job. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnb

Re: signal propogation to backgrounded subshells

2007-03-06 Thread Andreas Schwab
Jeff Weber <[EMAIL PROTECTED]> writes: > enable job control, $ set -m > and kill the entire backgrounded job from a second > non-interactive script? You send the signal to the process group. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH,

Re: signal propogation to backgrounded subshells

2007-03-06 Thread Andreas Schwab
nteractivity and job control are orthogonal concepts. > If the process group of the background job could be returned or queried when > the background job is launched, That's what $! is for. > Please let me know if I am misunderstanding, and thanks for your help. Don't top post.

Re: signal propogation to backgrounded subshells

2007-03-06 Thread Andreas Schwab
Jeff Weber <[EMAIL PROTECTED]> writes: > (/bin/kill is required. The bash builtin kill cannot kill > an entire process group.) Sure it can. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key finger

Re: history lines can be deleted even with histreedit = off

2007-03-22 Thread Andreas Schwab
e history. Its only function is to automatically offer a line with a failed history substitution for reedit. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B

Re: source(builtin) and read(2)

2007-03-23 Thread Andreas Schwab
if read returns -1 then this writes beyond array bounds. Also, file_size is size_t, but result is only int. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 4

Re: source(builtin) and read(2)

2007-03-23 Thread Andreas Schwab
as small as 32k. I guess I've never tried to source an autoconf configure > script on such a system. If your ssize_t is smaller than 32 bits you'll have to worry about more things than that. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße

Re: source(builtin) and read(2)

2007-03-23 Thread Andreas Schwab
Matthew Woehlke <[EMAIL PROTECTED]> writes: > Hmm... well then I guess this is broken: > /usr/include/limits.h:#define SSIZE_MAX53248/* max single I/O > size, 52K */ The creativity of system designers always amazes me. :-( Andreas. -- Andreas Schwab, Su

Re: variable assignments and parameter expansion in a single command

2007-03-24 Thread Andreas Schwab
;$A more" > echo $A , $B > should display moo twice or just once: > moo , moo more > moo , more "Each variable assignment shall be expanded [...] prior to assigning the value." That means that each assignment is supposed to be expanded _and_ performed in the same step

Re: bash-3.2 regression: command history display with coloured PS1.

2007-03-26 Thread Andreas Schwab
Peter Volkov <[EMAIL PROTECTED]> writes: > Steps to reproduce: > PS1="\e[36m[\e[34m\u\e[0m \e[32m\w\e[36m] \\$\e[0m " This is broken. You need to bracket escape sequences with \[ \]. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH,

Re: Another bash-3.2 regression: coloured prompt confuses Ctrl+R.

2007-03-29 Thread Andreas Schwab
n). > > I can't reproduce this with bash-3.2.15 and Fedora Core 5 in a Parallels > VM, with the Home key bound to beginning-of-line. Perfectly reproducible with bash 3.2.15 and TERM=xterm, see the attached typescript. Note the bogus 20 ^H after the prompt is redrawn. Andreas. -- An

Re: Another bash-3.2 regression: coloured prompt confuses Ctrl+R.

2007-03-29 Thread Andreas Schwab
Chet Ramey <[EMAIL PROTECTED]> writes: > I simply cannot reproduce it on the systems I have available. You need to be in a multibyte locale. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerpri

Re: Another bash-3.2 regression: coloured prompt confuses Ctrl+R.

2007-03-29 Thread Andreas Schwab
Chet Ramey <[EMAIL PROTECTED]> writes: > Andreas Schwab wrote: >> Chet Ramey <[EMAIL PROTECTED]> writes: >> >>> I simply cannot reproduce it on the systems I have available. >> >> You need to be in a multibyte locale. > > I used en_US

Re: Another bash-3.2 regression: coloured prompt confuses Ctrl+R.

2007-03-29 Thread Andreas Schwab
ershoot happens after end of isearch, no matter how you leave it. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something

Re: Another bash-3.2 regression: coloured prompt confuses Ctrl+R.

2007-04-01 Thread Andreas Schwab
Chet Ramey <[EMAIL PROTECTED]> writes: > OK, I'm stumped. Try again with PS1='\[\033[01;31m\]12345\[\033[01;34m\] \W \$\[\033[00m\] '. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key

Re: Result of "( false )" is 0, should be 1

2007-04-13 Thread Andreas Schwab
[EMAIL PROTECTED] writes: > Description: > Result of "( false )" is 0, should be 1 This is not the case. The exit code is correct, but only simple commands are causing the shell to exit with set -e. A subshell is not a simple command. Andreas. -- Andreas Schwab, S

Re: strange expansion of <(cat p.main.{optional,extra})

2007-04-18 Thread Andreas Schwab
> acters special to other expansions are preserved in the result. It is > strictly textual. Bash does not apply any syntactic interpretation to > the context of the expansion or the text between the braces." If it would be done strictly textual, the resulting expansion would act

Re: strange expansion of <(cat p.main.{optional,extra})

2007-04-18 Thread Andreas Schwab
Lucas Nussbaum <[EMAIL PROTECTED]> writes: > Well, no, because bash expands *parameters*, not words. So the prefix is > "<(cat /etc/", and the suffix is ")". But that would not be a *strict textual* expansion. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL

Re: strange expansion of <(cat p.main.{optional,extra})

2007-04-18 Thread Andreas Schwab
Eric Blake <[EMAIL PROTECTED]> writes: > According to Andreas Schwab on 4/18/2007 4:01 AM: >> Lucas Nussbaum <[EMAIL PROTECTED]> writes: >> >>> Well, no, because bash expands *parameters*, not words. So the prefix is >>> "<(cat /etc/&qu

Re: it seems that variables red by builtin function "read" are modified (or ignored) during execution

2007-04-26 Thread Andreas Schwab
do > echo "data=$data" > mplayer "inexistant-file.avi" 2>/dev/null 1>&2 Most likely mplayer is reading from stdin. You should redirect its input to avoid that. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Produ

Re: Bash arithmetic doesn't give error message on wrap.

2007-04-30 Thread Andreas Schwab
s aborted). > If bash were to be consistent, then it should display no error message in > the case of $((3+078)); This is a syntax error, so there is no sensible meaning attached to it. A syntax error is something quite different than an undefined behaviour. Andreas. -- Andreas Schwab, SuS

Re: Bash arithmetic doesn't give error message on wrap.

2007-04-30 Thread Andreas Schwab
27;s done in assembly. In C, it's somewhat more > compilcated. For example: > result=a*b; > if (result/a!=b) { report overflow; } That won't work, since (signed integer) overflow is undefined in C. A compiler is allowed to optimize the condition to false. Andreas. -- An

Re: How to remove a specific line in a file

2007-05-01 Thread Andreas Schwab
ou want. > > $ sed --in-place $SEDCOMMAND $SOMEFILE > > This is available in sed version 4 and later. Or use ed. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B

Re: Characters aren't being properly escaped/evaluated in a Bash

2007-05-10 Thread Andreas Schwab
[EMAIL PROTECTED] writes: > Fix: > The problem lies in the parser somewhere, The problem is that you are not correctly quoting. Better use $(...) instead of `...`, that is easier for beginners to get right. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Pr

Re: newlines and $(...) processing

2007-05-13 Thread Andreas Schwab
000 0a > $ printf "\n" | wc -c > 1 > > But when this is used with a command substitution the newline > disappears. Command substitution always strips trailing newlines. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeld

Re: set function and special builtin set

2007-05-18 Thread Andreas Schwab
of a special built-in utility, that special built-in utility shall be invoked. (And set is a special built-in.) Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany

Re: some more inline assignments / evaluation wrt POSIX

2007-05-18 Thread Andreas Schwab
nt "0.net" always be displayed ? looks like A is always set properly > to "0.net", but in the first statement, $A gets expanded before the variable > assignments are processed See <http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_09_01>.

Re: Quotes inserted into command

2007-05-22 Thread Andreas Schwab
ting. > /usr/bin/java -cp '"/path/to/classes"' com.choicestream.foo > But it will display: > /usr/bin/java -cp "/path/to/classes" com.choicestream.foo There is no difference between the versions, the executed command is always the same. If you wa

Re: last element of an array

2007-05-24 Thread Andreas Schwab
"Poor Yorick" <[EMAIL PROTECTED]> writes: > The syntax I'm currently using to access the last element of an array looks a > little evil: > >>arr=( one two three ) >>echo ${arr[$(([EMAIL PROTECTED]))]} At least you can leave out the $((...)) construct

Re: Timing an operation

2007-05-25 Thread Andreas Schwab
interval$i=$(($date2 - $date1)) #1st & 2nd errors If you want to set a computed variable you need to use eval. eval interval$i='$(($date2 - $date1))' Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409

Re: tracing inside functions

2007-05-31 Thread Andreas Schwab
Chet Ramey <[EMAIL PROTECTED]> writes: > Nic James Ferrier wrote: >> Using bash 2.05, does anyone know of a way to get a trace of what's >> happening inside a function? > > Only by adding `set -x' inside the function body. Or by upgrading to a shell

Re: Please exclude ".." and "." in path completion of ".*"

2007-06-03 Thread Andreas Schwab
ortunately there have been "dot files" in the user profile and so I tried > this command to catch them: > > chmod -R $USERNAME .* You could have just used "." as the argument. Saves a key. :-) > Another example: How would I kill all files on a mounted removable media

Re: Improper UTF-8 combining character handling

2007-06-12 Thread Andreas Schwab
U+1E0A. This works correctly with current versions of xterm or konsole. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5

Re: logical XOR

2007-06-29 Thread Andreas Schwab
t; echo $? > > shows syntax error. true and false are not numbers. The OP was talking about expression evaluation. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756

Re: MacOS X 10.4.10 and Bash 3.2

2007-06-30 Thread Andreas Schwab
You either want --bindir=/bin or --exec-prefix= (ie. empty). Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And n

Re: Arithmetic expressions and parameters with newlines breaks

2007-07-02 Thread Andreas Schwab
gt; $ echo $((foo)) > bash: 12 > 34: syntax error in expression (error token is "34") Why do you think this is a bug? Two numbers separated by whitespace cannot form a valid expression. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux P

Re: Offset error (when using PS1 with colors and newline)

2007-07-12 Thread Andreas Schwab
dAniel hAhler <[EMAIL PROTECTED]> writes: > 1. Set PS1="\033[01;37m[ \[\033[01;34m\]\w\[\033[00m\] > \033[01;37m]\n\$\033[00m " You need to bracket _every_ nonprinting sequence of characters with \[\]. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] Su

Re: Exit-on-error option does not work as expected

2007-07-17 Thread Andreas Schwab
command's return status is being inverted using `!'. A trap on `ERR', if set, is executed before the shell exits. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 5

Re: subshell vs. su and +e

2007-07-21 Thread Andreas Schwab
if ((${?}!=0)) # <--- ${?} is zero here not 127 ? The variable is already substituted while the here-document is read. Either quote the dollar sign, or use a quoted here-document. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409

Re: escaping exclamation in double quoted string

2007-07-28 Thread Andreas Schwab
he 3 characters >> '!', I have to do something like echo "'"'!'"'" whereas true >> escaping would allow the more readable echo "'\!'" $ echo \'\!\' Since ! is an interactive only feature there is not m

Re: Help with script --

2007-08-28 Thread Andreas Schwab
Bernd Eggink <[EMAIL PROTECTED]> writes: > t0nedef schrieb: > >> echo "Please enter a network name" >> read ESSID >> if [ -n $ESSID ] > > You probably meant: > if [ -z $ESSID ] Really you want this: if [ -z "$ESSID" ] Andreas.

Re: bash root ~/.bash_profile quirk

2007-09-06 Thread Andreas Schwab
ironment variable not show > up? A setuid binary ignores LD_LIBRARY_PATH for security reasons. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 &quo

Re: builtin echo command redirection misbehaves in detached scripts when terminal is closed

2007-09-09 Thread Andreas Schwab
cho b > a' | : bash: line 0: echo: write error: Broken pipe and the file contains only one line. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."

Re: builtin echo command redirection misbehaves in detached scripts when terminal is closed

2007-09-09 Thread Andreas Schwab
Stephane Chazelas <[EMAIL PROTECTED]> writes: > That was on Linux, glibc 2.6.1. Same. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5

<    1   2   3   4   5   6   7   8   9   >