Re: Undocumented behaviour - parameter expansion ${par-word}

2012-09-04 Thread Jan Schampera
On 04.09.2012 13:13, Roman Rakus wrote: Hi, Petr, adding to cc: list, found behaviour not documented, neither in man page nor bash ref manual: ${par-word} will do expansion of par, and if the par is unset it is substituted by word. It is different from ${par:-word}, where word is used when par

Re: Massive recursion - SEGV

2012-07-02 Thread Jan Schampera
On 02.07.2012 15:57, Eric Blake wrote: Look for FUNCNEST variable. In recent release it is available. I more meant the shell interpreter, less the code I can write. It would be possible to link bash with libsigsegv to install a graceful stack overflow handler that allows a nicer exit

Re: Massive recursion - SEGV

2012-07-02 Thread Jan Schampera
On 02.07.2012 20:57, Chet Ramey wrote: On 7/2/12 2:36 PM, Jan Schampera wrote: The origin of this all was a bugreport to me about the manual lying about no limits on recursion That's funny. Aye. A bit of confusion. -- Be conservative in what you do, be liberal in what you accept from

Massive recursion - SEGV

2012-07-01 Thread Jan Schampera
Hi folks, a suggestion about recursive function calls (and not only that, of course). Do you see a way for Bash to pull the emergency break before it runs out of stack here (to provide an error to the user, rather than a crash): f1() { f1 } f1

Re: Massive recursion - SEGV

2012-07-01 Thread Jan Schampera
On 01.07.2012 14:37, Roman Rakus wrote: Look for FUNCNEST variable. In recent release it is available. I more meant the shell interpreter, less the code I can write. -- Be conservative in what you do, be liberal in what you accept from others. - jbp, master of the net, in RFC793

Re: printf treats arguments of %c not as expected

2011-06-23 Thread Jan Schampera
Hi, I agree this is not a bug. %c works as described. However, Mr. Wang may want to read one of Greg's brilliant FAQ entries [1]. In general it's a bit of a pity that printf can do character-number conversion, but not (directly) back. But it is like it is and the workarounds are not really

Re: printf treats arguments of %c not as expected

2011-06-23 Thread Jan Schampera
Yunfeng Wang wrote: Perhaps bash should clarify this issue in its documents such that users like me would not be misguided again. Since the reference to printf(3) is misleading sometimes, I made some document [1] for Bash's printf only. It's far from perfect, but at least it mentions %s

Re: Permission denied to execute script that is world executable

2011-06-18 Thread Jan Schampera
John Williams wrote: I find that I cannot execute world-executable scripts when they are in a directory which is mounted on a drive on an HBA (host bus adapter Can you show the mount options of the filesystem? -- Be conservative in what you do, be liberal in what you accept from others. -

Re: Question about testing with variable operators

2011-06-11 Thread Jan Schampera
Andreas Schwab wrote: Steven W. Orr ste...@syslang.net writes: As a work around, I can use eval or the builtin test, but my question is this: Is this a bug or is there a reason that it should work for arithmetic but not for the test [[ operator? [[ is a reserved word like if, which triggers

Re: documentation bug re character range expressions

2011-06-02 Thread Jan Schampera
Hi, just as side note, not meant to touch the maintainer discussion. This is not only a Bash problem. The programmer/user mistake to use [A-Z] for only capital letters, capital A to capital Z is a very common one. But I'm not sure if every official application-level documentation should

Re: Bash source repository

2011-05-31 Thread Jan Schampera
Bradley M. Kuhn wrote: I humbly suggest that http://git.savannah.gnu.org/cgit/bash.git be replaced with this repository above that I've created. The new repository contains everything that the current Savannah one does, but I put much more effort into making commits fine-grained, rather than

Re: Here strings and pathname expansion

2011-02-14 Thread Jan Schampera
Roman Rakus wrote: It is noted in Here Documents (and Here Strings is a variant of here documents). And there is: No parameter expansion, command substitution, arithmetic expansion, or pathname expansion is performed on word. This is not true for here strings (infact, it wouldn't make sense

Here strings and pathname expansion

2011-02-13 Thread Jan Schampera
Hello world, I recently answered a question about using the asterisk mixed with redirection and other words. This also lead me to the documentation that states (REDIRECTION section): --- The word following the redirection operator in the following descriptions, unless otherwise noted,

Re: 'help set' missing '--'

2011-01-10 Thread Jan Schampera
Dennis Williamson wrote: I think this distinction from the man page is what's missing in the help: [...] Exactly. Thanks for pointing it out, I thought it was clear :) -- Be conservative in what you do, be liberal in what you accept from others. - jbp, master of the net, in RFC793

Re: for; do; done regression ?

2011-01-10 Thread Jan Schampera
Marc Herbert wrote: seq is not exactly Linux-only but GNU-only. GNU-specific versus bash-specific, which is worse? I'd say it depends... on which mailing-list you post :-) I'd say a script interpreted by the GNU shell must not rely blindly on GNU tools being installed or on running on a GNU

'help set' missing '--'

2011-01-09 Thread Jan Schampera
Hello, the help output for the set builtin command misses '--'. The manpage is ok. (recognized by 'yitz' on irc://irc.freenode.net/#bash) -- Be conservative in what you do, be liberal in what you accept from others. - jbp, master of the net, in RFC793

Re: Huge execution time in 4.2, WAS: for; do; done regression ?

2011-01-07 Thread Jan Schampera
Chet Ramey wrote: I can't imagine this is just some debugging code still active (it's a beta). Imagine. Anything that doesn't have a version tag of `release' has DEBUG enabled for the preprocessor, which enables MALLOC_DEBUG. If you're using the bash malloc, MALLOC_DEBUG turns on extensive

read builtin and readonly variables

2011-01-03 Thread Jan Schampera
Hello list, the read builtin command, when trying to assign to a readonly variable after reading the data, spits an error message. This is fine. But the return status is 0. It always (down to 2.04 was tested) has been like that, and it's like that in upcoming 4.2. For me, this doesn't

Re: Referencing empty array with set -u active throws error

2010-12-18 Thread Jan Schampera
jens.schmid...@arcor.de wrote: For an empty $@ this does not throw an unbound error, which seems to be an inconsistent behaviour to me. -u Treat unset variables as an error when substituting. I think the behaviour is consistent with the documentation. -- Be conservative in what you do,

Re: quotes invade positional parameters

2010-12-18 Thread Jan Schampera
jida...@jidanni.org wrote: $ cat 201012contract #!/bin/sh -eux set a b c d e f : ''$@'' : ' '$@' ' : ''$*'' : '' $* '' : $* $ ./201012contract + set a b c d e f + : a b c d e f + : ' a' b c d e 'f ' + : 'a' b c d e 'f' + : '' a b c d e f '' + : ' a' b c d

Re: nounset option does not work with array in arithmentic expressions

2010-12-18 Thread Jan Schampera
Joerg Boehmer wrote: The value of variable ar[1] is expanded to 0 although it was not set. The full syntax produces the expected behavior: The value of y is 0, since you operate in arithmetic context. This is fine. But I definitely agree it should bail out here. -- Be conservative in what

Re: ionice bash pid in bash_profile Fails

2010-11-22 Thread Jan Schampera
Roger wrote: If you want the PID of the current shell process, use $$ instead. Yes I do. It's only me on this computer, unless you're speculating on prioritizing a snooper. :-O This is (in this context) not related to the number pf bash processes running. Not at all. -- Be conservative

Re: pwd does not update when path component is renamed

2010-09-20 Thread Jan Schampera
Krzysztof Zelechowski wrote: Description: The text of pwd and the value of $PWD return a cached value, regardless of the actual current path. Repeat-By: mkdir '-p' 'a' cd 'a' mv '../a' '../b' enable '-n' 'pwd' builtin 'pwd' pwd Fix: cd '-P' '.' I think it's

Re: RFE: request for quotes as grouping operators to work in brackets as elsewhere.

2010-09-18 Thread Jan Schampera
I'm sorry to not answer a message directly, but I didn't get the mails of this list during the last day - no idea why. Quoting text from the pipermail archive. After initialÄy introducing =~, Chet made it consistent with =/== in a second version, means: =/== doesn't do pattern matching for

Re: discrepancy with variable assignments and simple commands between sh and bash

2010-08-24 Thread Jan Schampera
Mike Frysinger wrote: the difference here being the value in variable a after function f finishes executing. i was expecting the behavior of `bash`, not of `sh`. i cant seem to find anything covering this in the man page except for perhaps interpreting the meaning of some sections to mean

read -d'' -n1

2010-08-11 Thread Jan Schampera
Hello, don't ask about the detail how I originally invented this code, but I stepped over something I really can't explain: 1) Why doesn't this print anything while read -d'' -n1 ch; do echo $ch done $'hello\nworld' 2) Why does this print something, but only up to the hyphen? while

Re: read -d'' -n1

2010-08-11 Thread Jan Schampera
Jan Schampera wrote: 1) Why doesn't this print anything while read -d'' -n1 ch; do echo $ch done $'hello\nworld' 2) Why does this print something, but only up to the hyphen? while read -d'' -n1 ch; do echo $ch done $'hello\nwor-ld' Please ignore this question. 2 minutes after

Re: RFE? request for an undefined attribute for functions

2010-08-02 Thread Jan Schampera
Linda Walsh wrote: On 8/2/2010 1:13 PM, Chet Ramey wrote: There are several versions of `autoload' in examples/functions. Chet === I've been using 'man bash' as my reference. I don't see a reference to examples or autoload, and finding 'functions' doesn't show me any examples. Is

Re: function grammar

2010-07-19 Thread Jan Schampera
Linda Walsh wrote: The curly brackets are suposed to be optional. They are line 2 of the Compound commands list below... Don't ask me why, but it works when you don't use the function keyword, but () instead: foo() [[ 1 ]] Might be a parsing bug, though you shouldn't use function at all.

Substitution PE parsed wrong or doesn't work correctly

2010-07-15 Thread Jan Schampera
Hello, Tested versions: - 4.1.2(1)-release - 3.2.39(1)-release Reproduce by: string=1/2 3= echo ${string//[= /]} Expected result: 123 Actual result: 1/2 3= Workaround: Escape the inner slash with a backslash. Within a bracket expression, the slash should lose its special meaning.

Re: RFE: 'list of vars' = split expr VAR

2010-06-29 Thread Jan Schampera
Linda Walsh wrote: I suppose I'm presuming these features are not already implemented in some fashion -- did I overlook them, or would they be 'new'? I know it's not applicable for all cases, but I usually use read to split strings into variables/an array. J.

Re: Bash cannot kill itself?

2010-06-29 Thread Jan Schampera
Clark J. Wang wrote: Running a cmd in background (by ) would not create subshell. Simple testing: #!/bin/bash function foo() { echo $$ } echo $$ foo ### END OF SCRIPT ### The 2 $$s output the same. This doesn't mean that it doesn't create a subshell. It creates one, since it can't

Re: A note for read builtin

2010-06-18 Thread Jan Schampera
Britton Kerin wrote: How so? It seems that read always reads from the terminal even when its in a shell pipeline. This isn't correct. Read reads from STDIN by default. Regards, Jan

Re: A note for read builtin

2010-06-18 Thread Jan Schampera
Dr. Werner Fink wrote: The question rises: Why does the bash require a sub peocess/shell for the final command of a pipe sequence. I'd think this is more or less a design choice at first (with one or the other issue, maybe for both solutions - though I can't construct a failing case for the

Re: A note for read builtin

2010-06-18 Thread Jan Schampera
RESEND FOR THE MAILINGLIST Britton Kerin schrieb: Which in a pipeline is supposed to be the output of the previous command, right? Its not at all obvious to me why it behaves as it does. The other subthread of this thread is about it: In Bash, all parts of a pipeline are executed in an own

Re: A note for read builtin

2010-06-17 Thread Jan Schampera
Marc Herbert schrieb: From section 2.12 and from messages posted here in the past I understand that POSIX allows either one. This ambiguity reinforces the need for documentation IMHO. I agree with Greg here, it's a well known don't. What should be documented is (maybe it is?) how pipelines

Re: Input line length

2010-06-06 Thread Jan Schampera
Chet Ramey wrote: How about a stack traceback? I'm so sorry, I thought this was clear and easy to reproduce/verify. I'm using this to generate the script. The number of commands varies between shell versions (and likely other platform stuff), so you might need to play around with the

Re: Input line length

2010-06-06 Thread Jan Schampera
Oh, and to be complete: uname -rms yields: * Linux 2.6.26-2-amd64 x86_64 The C library is a: * GNU libc 2.16.6-3 The crashed Bash is a: * ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, not stripped Jan TheBonsai

Input line length

2010-06-05 Thread Jan Schampera
Hello list, somebody in chat just asked about the maximum input line length, I know (and told him) that this might be very platform dependent, but I did some tests. The result of these tests was a SEGV (after some 78K line length). Shouldn't this be sanely catched somehow by the parser? I

Re: Wrong alignment in select lists

2010-05-31 Thread Jan Schampera
Bernd Eggink wrote: Select lists are sometimes displayed with incorrect vertical alignment if an item contains one or more German umlauts. Examples: select x in äöü blah{1..20}; do :; done# wrong select x in amöbe blah{1..20}; do :; done# wrong select x in amöb

Weird behaviour of 'hash' builtin

2010-05-30 Thread Jan Schampera
Hello Chet, hello list, during some discussion in the IRC #bash channel on freenode we found a weird behaviour of the 'hash' builtin command. The command exits true if the operand in question contains a /, no matter if that makes sense or not: --- $ hash

Re: Undocumented usage of printf?

2010-04-15 Thread Jan Schampera
Clark J. Wang schrieb: I saw a printf usage from a Linux forum's post: # printf %d\n 'a 97 # It's really cool but I found no info in bash's manual. Are there any other undocumented interesting features? :) I documented it, though I don't remember where I first heard about it. Maybe I

Re: Feature request: Can bash provide some mechanism for locking/unlocking?

2010-04-15 Thread Jan Schampera
Clark J. Wang schrieb: In C code I can use lockf(), flock(), semaphore and mutex for locking / unlocking. Can bash provide some similar mechanisms? For simple things, which don't need to be 1000% rocksolid, you can use atomic operations like mkdir or noclobbered redirection for mutex

Re: Feature request: Can bash provide some mechanism for locking/unlocking?

2010-04-15 Thread Jan Schampera
Clark J. Wang schrieb: And if the script crashes the dir will be left unlocked. System crashes and kill -9 are the problem. The rest is none. If the area isn't too complex, noclobbered redirection serves well. But if you have other options, they should be used, of course. (doing this on a

Re: bash exit command should be unconditional

2010-04-07 Thread Jan Schampera
Vadym Chepkov schrieb: I would expect never see Continue printed The 'exit' command exits the subshell you just created. http://bash-hackers.org/wiki/doku.php/scripting/processtree There's also a FAQ about it, E4. Jan

Crash on completion

2010-03-09 Thread Jan Schampera
Hello list, hello Chet. Bug reported on freenode's IRC #bash by: Satgi There is a crash somewhere in completion (the last commandline is completed using TAB): echo $BASH_VERSION 4.1.2(1)-release mkdir -p the/?/directory ./the/\?/Segmentation fault (core dumped) These completions DO NOT

Re: command not put into history if it starts with space

2010-02-06 Thread Jan Schampera
Mike Frysinger schrieb: When using the bash shell in an xterm or rxvt terminals at least, commands executed which start with a space, eg ls are not added to the command line history and so are not accessible by ctrl-p. this is by design -mike This is controlled by the HISTCONTROL and

Re: Error when script uses CRLF line endings w/ if stmt

2010-02-05 Thread Jan Schampera
Evan Driscoll schrieb: Then, many programs don't handle them per se, but *not* handling them doesn't cause much problem. grep, cat, and echo probably fall in this category. Bash doesn't handle it. It's a character like 'A' or 'B'. It causes problems :) J.

Re: Error when script uses CRLF line endings w/ if stmt

2010-02-05 Thread Jan Schampera
Andreas Schwab schrieb: It's a character like 'A' or 'B'. 'A' and 'B' are letters, $'\r' is whitespace. Yes... :)

Re: Error when script uses CRLF line endings w/ if stmt

2010-02-04 Thread Jan Schampera
drisc...@cs.wisc.edu schrieb: Some of the time, using CRLF line endings cause syntax errors in Bash scripts (unexpected end of file). This problem shows up on Bash 4.1 on Linux, Bash 3.2 on Linux, and Bash 3.2 on Cygwin (where I first noticed it). Normal. Though I

Re: Selecting out of an array

2010-01-25 Thread Jan Schampera
Jon_R schrieb: http://old.nabble.com/file/p27316649/newsh2.sh newsh2.sh You have a misunderstanding about select here, I guess. Select is supposed to display a list of given words and take user input (index to these words). It more or less is the same as a for loop, it just doesn't iterate

Re: $(pwd) != $(/bin/pwd)

2010-01-03 Thread Jan Schampera
Leonid Evdokimov schrieb: This problem may be fixed if bash does not optimise number of getcwd() calls, but I'm not sure if the bug is really a _bug_, but not a sort of strange feature. Depends what 'bar' is above, assuming it's a (sym-)link or a bind here: IMHO this is not a bug. There

Re: $(pwd) != $(/bin/pwd)

2010-01-03 Thread Jan Schampera
Leonid Evdokimov schrieb: This problem may be fixed if bash does not optimise number of getcwd() calls, but I'm not sure if the bug is really a _bug_, but not a sort of strange feature. Sorry, I didn't read carefully enough :) J.

Re: command_not_found_handle not called if command includes a slash

2009-12-29 Thread Jan Schampera
Ken Irving schrieb: This patch is not sufficient, as it leaves the error message, but it does call the hook function in the problem cases: I'm just not sure if it makes sense. I mean, if the user requests the execution of a *specific file*, what should the hook function do if it fails?

Re: command_not_found_handle not called if command includes a slash

2009-12-29 Thread Jan Schampera
Ken Irving schrieb: That's up to that function to determine, since bash passes control over to it. It should be able to handle whatever it gets. My use case is to take things that look like 'object.method' -- which are not likely to collide with normal executables -- and run them under a

Re: command_not_found_handle not called if command includes a slash

2009-12-27 Thread Jan Schampera
Ken Irving schrieb: Description: I'm not sure this is a bug, but I notice that the command_not_found_handle function is not called if the command has a slash in it. I can't find anywhere in the bash source producing the No such file ... error message, so I guess this is

Re: Query regarding ${parameter:-word} usage

2009-12-23 Thread Jan Schampera
Mun schrieb: nounset on Something sets -u in your startup scripts (or in the script or whatever)

Re: have bg, fg, but lack stop

2009-12-19 Thread Jan Schampera
jida...@jidanni.org schrieb: OK, never mind. Market demand too low to add... I rather think you could just define a stop()

Re: IFS handling and read

2009-11-30 Thread Jan Schampera
Lhunath (Maarten B.) schrieb: My bad. I was under the impression `read` was a Bourne shell-only thing and not standardized under POSIX. (not personal for you only, I see that very often) It would be nice if people actually read POSIX before they talk about it. Jan

Re: ( error

2009-11-28 Thread Jan Schampera
Antonio Macchi schrieb: $ hd (echo -en \\0{0..3}{0..7}{0..7}) it breaks the console. It doesn't break the console, it crashes the shell (here with a subshell to get the text): bon...@core:~$ bash bon...@core:~$ hd (echo -en \\0{0..3}{0..7}{0..7}) malloc: ../bash/subst.c:4198:

Re: caller builtin returns wrong lineno when sourced

2009-11-23 Thread Jan Schampera
Just for completeness: Same with 3.2.39, 4.1 alpha and beta. Jan

Re: Bash source repository

2009-11-22 Thread Jan Schampera
Chet Ramey schrieb: That's how I prefer it. I don't do public development on savannah, and I do controlled test releases. The official patches should be there as individual commits. Though, I admit it's not a small amount of work to do all that for the past releases. Such a GIT or SVN

Re: for i in {1..100000...

2009-11-12 Thread Jan Schampera
Antonio Macchi schrieb: what's the rasonable limit in using this compact contruct, after which the for (( i=0; i1000...; i++ )) became better? Hardware/OS limits. J.

Re: Error handling question

2009-11-08 Thread Jan Schampera
Ciprian Dorin, Craciun schrieb: Thus if I say: `set -e ; { false ; true ; }` it works, but when I put the `||`, it doesn't... I think it's because { ...; } isn't a simple command (however, its components are). J.

Documentation issue: Increments in brace expansion

2009-10-30 Thread Jan Schampera
Good morning, http://www.gnu.org/software/bash/manual/bashref.html#Brace-Expansion The brace expansion increment syntax is shown wrong. OLD: A sequence expression takes the form {x..y[incr]}, where x and y are either integers or single characters, and incr, an optional increment, is an

Re: 100% cpu with: while true ;do read /dev/null ;done

2009-10-21 Thread Jan Schampera
Jo King schrieb: Fix: [ bash/the read code could detect there's no stdin and sleep for 1-2 seconds] If you consider this as a bug, the bug is not in Bash (but in the application). In short you request that read should wait a second, once it got a end-of-file signalled, I don't think

Re: Infinite loop on clearing PWD

2009-10-13 Thread Jan Schampera
Marc Herbert schrieb: Repeat-By: $ unset PWD Fix = readonly PWD ? This is not a fix, this is a workaround. Anyways, I can't reproduce it. J.

Re: $() parsing still broken

2009-09-20 Thread Jan Schampera
Hey Chet, I can reproduce it. What can I do to help tracking it down? bon...@core:~/devel/bash-4.0$ ./bash -c 'echo $(echo \|)' ./bash: command substitution: line 1: syntax error near unexpected token `)' ./bash: command substitution: line 1: `echo \|)' bon...@core:~/devel/bash-4.0$ ./bash -c

Re: $() parsing still broken

2009-09-20 Thread Jan Schampera
Jan Schampera schrieb: It was a fresh install. Unpacking source + applying pathces, then build *scratches beard*. And it was done without bison - my bad. Works now. Jan

Re: bug or undocumented feature

2009-08-22 Thread Jan Schampera
Mitch Frazier wrote: The close appears to be a special case of (from the man page): Similarly, the redirection operator [n]digit- moves the file descriptor digit to file descriptor n, or the standard output (file descriptor 1) if n is not specified. Not sure if that's a bug or

Re: bash 4.x filters out environmental variables containing a dot in the name

2009-06-27 Thread Jan Schampera
Christian Krause wrote: Given all of these facts I still tend to say that the bash shouldn't filter them... There's always the following argument: Other characters may be permitted by an implementation; applications shall tolerate the presence of such names. I agree with Christian here. As

Re: [Feature Request]export extglob from environment

2009-05-10 Thread Jan Schampera
Hello Chet, hello Raph, I was involved in the discussion on IRC (Freenode / #bash) yesterday, maybe I can give one or the other comment. It took a while for us to find out why it happens. When we knew it, and after some discussion, we agreed that the easiest way would be to make Bash able to

Re: Brace expansion

2009-04-05 Thread Jan Schampera
Ray Parrish wrote: bash: printf: 08: invalid number 0 bash: printf: 09: invalid number Arithmetic expression/base specifications: http://bash-hackers.org/wiki/doku.php/syntax/arith_expr#different_bases Seems to apply for all numerical formats for printf, too. J.

Re: feature-request: brief syntax for $(type -p somecommand)

2009-04-02 Thread Jan Schampera
Mike Coleman wrote: [Oops--I sent that incomplete.] It would be nice if there was some really brief syntax for $(type -p somecommand) I find myself using this all day long with 'ls', 'file', 'ldd', 'strings', 'nm', etc., and the current incantation is just long enough to be

Re: contents of whole arrays dissapears leaving while read loop

2009-03-26 Thread Jan Schampera
Lennart Schultz wrote: In the construct cat file|while read line do done the content of any arry assignments in the loop dissapears leaving the loop: This is logic, since every part of the pipe runs in an own subshell (the first one runs in the current shell). This behaviour is also *not*

Re: [bash-bug] contents of whole arrays dissapears leaving while read loop

2009-03-26 Thread Jan Schampera
Dr. Werner Fink wrote: This is not a bug, this is a consequence of Bash's design. Yep ... nevertheless a side mark: ksh can do ;) Which is: A consequence of Korn's design ;-) *waves the 80km to Nuremberg* Jan

Re: Feature Idea: Enhanced Tab Completion

2009-03-21 Thread Jan Schampera
Cam Cope wrote: Combine tab completion with history: when you put ! at the beginning of a command and use tab completion, it displays history results IMHO yet a new history expansion/editing/searching mechanism (there already are a few) would bloat it even more. But that's just my opinion. J.

Re: reference dir ../common in script

2009-03-05 Thread Jan Schampera
OnTheEdge wrote: I'm trying to check for a directory and create it if it doesn't exist as follows: CommonDir=../common if [ -d ${CommonDir} ]; then mkdir ${CommonDir} fi It works from the command line, but my script doesn't seem to like it and I can't figure it out. Thanks for

Re: arguments to script prefixed with -- in debug

2009-02-27 Thread Jan Schampera
lehe wrote: Hi, I am trying to debug my shell script by bashdb. My script take as argument --gdb, so I wrote bashdb myscript.sh --gdb However, this way it will produce error that bashdb: unrecognized option '--gdb' If I quote --gdb as bashdb myscript.sh '--gdb' then I will

Re: large exit values (255)

2009-02-25 Thread Jan Schampera
Mike Frysinger wrote: $ true $ echo 'enter ctrl+d $ echo $? 258 $ true $ echo 'enter ctrl+d $ echo 'enter ctrl+c $ echo $? 386 that doesnt seem right to me :) the first test seems fine, and older versions of bash would set 258 for the second test (not sure if it's correct

Re: large exit values (255)

2009-02-25 Thread Jan Schampera
Mike Frysinger wrote: $ true $ echo 'enter ctrl+d $ echo $? 258 $ true $ echo 'enter ctrl+d $ echo 'enter ctrl+c $ echo $? 386 Just tested it, hopefully it's as easy as changing every itos (last_command_exit_value) to itos (last_command_exit_value 0xFF) in subst.c (seems 2

Re: coproc command doesn't accept NAME arg

2009-02-24 Thread Jan Schampera
Tim Hatch wrote: Pilot:~/tmp/bash-4.0 tim$ coproc NAME ls [1] 18474 Pilot:~/tmp/bash-4.0 tim$ ./bash: line 32: NAME: command not found [1]+ Exit 127coproc COPROC NAME ls For some reason it expects a compound command on named coprocesses,

Re: Bash with colors?

2009-02-16 Thread Jan Schampera
Antonio Macchi wrote: commands like ls --color does not use terminfo capabilities... ...use instead fixed strings (without regards about TERMinal) is this a good (and safe) choice too? IMHO not. Too many assumptions. GNU ls seems to always assume an ANSI terminal, regardless which TERM is

Re: Bash with colors?

2009-02-15 Thread Jan Schampera
tal396 wrote: there is any way to echo aaa or any msg in colors? Start at http://bash-hackers.org/wiki/doku.php/scripting/terminalcodes and continue at whatever Google spits out for: - bash colors - terminal colors - ANSI colors - VT100 colors J.

Re: Help: Bash script that show you the last file created?

2009-02-15 Thread Jan Schampera
Mike Frysinger wrote: Without looking there: It can't be documented, because there's no general way to retrieve the creation time of a file. the op wasnt asking for the time, they were asking for the last created file. and the ls man page talks how to sort by ctime. Yes, that's the

Re: if, -n string

2009-02-01 Thread Jan Schampera
coubeatczech wrote: c...@notas:~$ if [ -z $variable ]; then echo true; fi true c...@notas:~$ Can anybody explain to me this behaviour? I would expect not any output in the last command...? The variable is set to zero and there is the condition is still true...?

The colon

2009-01-26 Thread Jan Schampera
Hi. In comp.unix.shell [1] somebody wondered about IFS=: read a b a:b; echo '$a' '$b' ending up in 'a b' '' Korn and Z seem to behave different. I see that across all my available Bash versions. I remember the colon to be special in some way (was it hostnames in a file path?), but I don't

Re: Bash 4: command_not_found_handle event handler

2009-01-20 Thread Jan Schampera
Jan Schampera wrote: Hello list! Just a few thoughts, awaiting comments. Heh. I wanted to raise a discussion about that issue, but it seems I failed (or I'm the only one who cares) ;) Jan

Re: simple bug/compat question

2009-01-19 Thread Jan Schampera
Linda Walsh wrote: Am running an older bash version and this may be fixed (assuming it is a bug and I'm not confused...:-)) bash version = 3.2.39(20) This works: 1)if [ -n -a 2 -gt 1 ] ; then echo one;fi This does not: 2)if [[ -n -a 2 -gt 1 ]] ; then echo one;fi

Bash 4: command_not_found_handle event handler

2009-01-16 Thread Jan Schampera
Hello list! Just a few thoughts, awaiting comments. Currently, Bash 4 calls a fixed named function command_not_found_handle() when a command is not found. The basic approach (to have such a possibility) is great, but: I can imagine that there may be more internal events to react on in future.

Re: [bash-testers] Re: case modification operators misbehaviour?

2009-01-14 Thread Jan Schampera
Chet Ramey wrote: The case modification operators (for parameter expansion) seem to be puzzled. Two things I don't understand: - it seems to work word-wise (might be due to my misinterpretion of the default pattern) It does work word-by-word, like the emacs-mode editing commands. I

Re: Question on bash clearwildcards

2008-11-22 Thread Jan Schampera
grendelos wrote: So this is really bugging me. Why is [a-z] not case sensitive, but [A-Z] is? For example: # ls -l total 0 -rw-r--r-- 1 root root 0 Nov 20 12:22 xa -rw-r--r-- 1 root root 0 Nov 20 12:22 xA # ls -l x[a-z] -rw-r--r-- 1 root root 0 Nov 20 12:22 xa -rw-r--r-- 1 root root

Development snapshot

2008-10-14 Thread Jan Schampera
Hello, is there something like a development snapshot for Bash 4 or is the code hidden during development phase and I need to wait for the first release? Thanks in advance, Jan -- This is my life - this is my net! - Jan

Re: feature request: wait --free-slot for poor man's parallelization

2008-10-03 Thread Jan Schampera
Mike Coleman wrote: Here's a bash feature I'd love to see, but don't have time to implement myself: a --free-slot flag to 'wait' that will wait until there is at least one free slot available, where a slot is basically a CPU core. Example usage: $ for ((n=0; n100; n++)); do my_experiment

Re: Bash prints syntax error when command in $(...) contains case-esac

2008-09-30 Thread Jan Schampera
Juergen Gohlke wrote: Description: If a command in $(...) contains a case-esac construction, the bash prints a syntax error instead of executing the code: bash: syntax error near unexpected token `;;' In case you have trouble with code you need, use this workaround:

Re: Last modified files with owner / time / permissions

2008-09-10 Thread Jan Schampera
lexton wrote: From what I read it is not good to use ls -la in the manner I use below. Could I run this by just using the find command with additional arguments? I still need to be able to print everything that the ls -la command gives me GNU find has an -ls option IIRC, which produces

Re: function name bug ?

2008-07-31 Thread Jan Schampera
christophe malvasio wrote: cbz (){ echo why 'cbz' not a valid function name ?;} bash: syntax error near unexpected token `(' It works for me. What does alias cbz say for you? alias work He wants to know if you probably have an alias named cbz defined, not if your alias engine works. J.

Re: set -x output of test operator is irretating

2008-07-31 Thread Jan Schampera
Bob Proulx wrote: Chet Ramey wrote: Toralf Förster wrote: I'm wondering why in the example (see below) the right side is prefixed with a '\' wheras the left side is unchanged. ... [EMAIL PROTECTED] ~ $ echo 1 2 3 4 | while read a b c d; do [[ $a = $b || $a = $c ||

Re: set -x output of test operator is irretating

2008-07-31 Thread Jan Schampera
Jan Schampera wrote: = and == should make have difference in behaviour. should not show differences *suh* Sorry J.

Re: Bash substrings: wish for support for negative length (read till n from end)

2008-07-07 Thread Jan Schampera
Richard Neill wrote: $ echo ${stringZ:2: -1} #Wish: start at 2, read till ERROR #1 before the end. i.e. # cde $ echo ${stringZ: -3: -1} #Wish: start 3 back, read till ERROR #1 before the end.

  1   2   >