Re: extension of file-test primitives?

2017-08-23 Thread dethrophes
0.140s sys 0m0.008s test_file_3 /tmp/exec_file real 0m0.142s user 0m0.140s sys 0m0.000s test_file_4 /tmp/exec_file real 0m0.118s user 0m0.112s sys 0m0.004s test_file_5 /tmp/exec_file real 0m0.162s user 0m0.148s sys 0m0.012s test_file_6 /tmp/exec_file real 0m0.142s user 0m0.132s sys 0m0.004s Am 2

Re: extension of file-test primitives?

2017-08-23 Thread dethrophes
ue if either expr1 OR expr2 is true. The main oses I work on are XSI conform. Am 23.08.2017 um 17:00 schrieb Chet Ramey: On 8/23/17 10:49 AM, dethrophes wrote: Well technically I don't *have* to accept the performance penalty. As I can just use the posix comform syntax, which is quicker. W

Re: extension of file-test primitives?

2017-08-23 Thread dethrophes
Am 23.08.2017 um 16:46 schrieb Greg Wooledge: On Wed, Aug 23, 2017 at 04:24:55PM +0200, Dethrophes wrote: Which I always understood as the correct way of doing this in the first place... It's not as good as multiple test commands: test -f file && test -x file. There's no

Re: extension of file-test primitives?

2017-08-23 Thread dethrophes
ser    0m0.116s sys 0m0.028s test_file_1 /tmp/exec_file real    0m0.138s user    0m0.128s sys 0m0.008s test_file_2 /tmp/exec_file real    0m0.153s user    0m0.128s sys 0m0.024s Am 23.08.2017 um 16:27 schrieb Chet Ramey: On 8/23/17 10:24 AM, Dethrophes wrote: Which I always underst

Re: extension of file-test primitives?

2017-08-23 Thread Dethrophes
> >> Which I always understood as the correct way of doing this in the >first place... > >It's not as good as multiple test commands: test -f file && test -x >file. >There's no ambiguity and you get short-circuiting. Only if you are using the test built-in, otherwise the latter means 2 spawns/f

Re: extension of file-test primitives?

2017-08-23 Thread Dethrophes
On August 23, 2017 3:37:51 PM GMT+02:00, Chet Ramey wrote: >On 8/23/17 9:34 AM, Greg Wooledge wrote: >> On Wed, Aug 23, 2017 at 04:22:09PM +0300, Pierre Gaston wrote: >>> testfile () { >>> local OPTIND=1 f=${!#} >>> while getopts abcdefghLkprsSuwxOGN opt; >>> do >>>

Re: Patch for unicode in varnames...

2017-06-07 Thread Dethrophes
Instead of talking in terms of seriousness, it may be more use to think in terms of formality. Even in gramitically strong and formal languages variable and function names are restricted in the characters they may use. This is not just because it makes the parsing simpler but because it simpli

Re: pattern substitution expands "~" even in quoted variables

2014-03-08 Thread dethrophes
backslash to escape still works? Sent from my BlackBerry 10 smartphone.   Original Message   From: Chet Ramey Sent: Samstag, 8. März 2014 01:52 To: Lars Wendler; bug-bash@gnu.org Reply To: chet.ra...@case.edu Cc: chet.ra...@case.edu Subject: Re: pattern substitution expands "~" even in quoted vari

bug-bash@gnu.org

2013-12-14 Thread dethrophes
I thought the value was only 0 if the fork/spawn was succesful. i.e. if it fails for lack of resources or something it's non zero. or have I miss understood it's significance? From: Chet Ramey Sent: Samstag, 14. Dezember 2013 05:05 To: Martin Kealey Reply To: chet.ra...@case

Re: child_pid of background process? (not in manpage?)

2013-08-19 Thread dethrophes
I actually had that problem as well, I found the description in the end it just took longer than I expected. Sent from my BlackBerry 10 smartphone. From: Linda Walsh Sent: Monday, August 19, 2013 19:53 To: bug-bash Subject: Re: child_pid of background process? (not in manpage

autocomplete error doesn't look to be in bash-complete so I'm reporting it here.

2013-08-16 Thread dethrophes
NDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -Wall uname output

Re: I have a bash style question. Feedback request.

2012-04-20 Thread dethrophes
Am 20.04.2012 16:38, schrieb Steven W. Orr: I manage a hefty collection of bash scripts. Sometimes, I make heavy use of pushd and popd. When problems come up, the directory stack can make debugging more complicated than I'd like. One thing I did to get better control over things was to write a

Re: inconsistency with "readonly" and scope

2012-04-12 Thread dethrophes
Am 12.04.2012 22:38, schrieb Steven W. Orr: On 4/12/2012 4:21 PM, dethrophes wrote: Am 12.04.2012 22:11, schrieb Steven W. Orr: On 4/12/2012 2:16 PM, dethrophes wrote: Am 12.04.2012 14:27, schrieb Chet Ramey: On 4/11/12 4:12 PM, dethrophes wrote: I've also noticed weird behavior

Re: inconsistency with "readonly" and scope

2012-04-12 Thread dethrophes
Am 12.04.2012 22:11, schrieb Steven W. Orr: On 4/12/2012 2:16 PM, dethrophes wrote: Am 12.04.2012 14:27, schrieb Chet Ramey: On 4/11/12 4:12 PM, dethrophes wrote: I've also noticed weird behavior with "declare -gr" the r sometimes seems to override the g, but not specific

Re: inconsistency with "readonly" and scope

2012-04-12 Thread dethrophes
Am 12.04.2012 14:27, schrieb Chet Ramey: On 4/11/12 4:12 PM, dethrophes wrote: I've also noticed weird behavior with "declare -gr" the r sometimes seems to override the g, but not specific to functions It seems to be specific either to the source file or to the compound state

Re: inconsistency with "readonly" and scope

2012-04-11 Thread dethrophes
Am 11.04.2012 20:50, schrieb Greg Wooledge: "declare" when used in a function acts like "local", and creates a variable with scope local to that function. So does "declare -r". But "readonly", which is otherwise the same as "declare -r", creates variables with global scope. Is this intended?

Re: Exit status of "if" statement?

2012-04-09 Thread dethrophes
If false; then echo jj fi always has to return 0 otherwise a lot of code using ERREXIT/ERRTRACE would break. if you want to handle an error case you should use elif or else your example could be written like this if cmd1 then cmd2 elif cmd3 then cmd4 fi or possibly like this if cmd1

Re: status on $[arith] for eval arith vsl $((arith))??

2012-04-08 Thread dethrophes
ever thought of going the depreciation route. Something like what microsoft do with vc. I.e. give a warning for depreciated constructs. With a hint as to how to do it better? Am 08.04.2012 21:30, schrieb Chet Ramey: On 4/8/12 3:02 PM, Maarten Billemont wrote: Any particular reason for not r

Re: Expanding aliases to full command before execution

2012-04-04 Thread dethrophes
Am 04.04.2012 17:27, schrieb jrrand...@gmail.com: On Tue, Apr 3, 2012 at 5:22 PM, jrrand...@gmail.com wrote: Hi everyone, In bash, is it possible to expand my aliases either before they are executed or when they are stored in the history file? For example, if I have: alias ll='ls -l' defined

Re: sed problem

2012-04-02 Thread dethrophes
Am 02.04.2012 15:25, schrieb Dennis Williamson: Wrong list. Your question is not about Bash and it's not about a bug in Bash. bash completion not bash. http://bash-completion.alioth.debian.org/

Re: which file in bash source code (tarball) contain a print output function

2012-03-20 Thread dethrophes
not sure if its what your looking for but you could look at builtins/printf.def as a starting point. it implements the printf builtin function. Am 20.03.2012 20:29, schrieb runicer: I have bash-4.2.tar.gz What inside this, All source code .c/.h , configuration file. I want to find where is the

Re: I think I may have found a possible dos attack vector within bash.

2012-03-20 Thread dethrophes
Greg Wooledge: On Tue, Mar 20, 2012 at 06:47:17PM +0100, dethrophes wrote: Secondly when you say dos? you mean a windows command prompt or you actually mean DOS 6.22, dosbox, or a text box what do you consider dos?. He meant DoS, or "Denial of Service". He believes he has found some s

Re: I think I may have found a possible dos attack vector within bash.

2012-03-20 Thread dethrophes
Am 20.03.2012 18:04, schrieb Greg Wooledge: On Tue, Mar 20, 2012 at 04:47:51PM +, Eamonn Smyth wrote: Without sounding alarmist, I can break my machine using bash. I also have a fix. I shall be officially releasing the c code this weekend at the hackathon london. You included some C++ code

Re: I think I may have found a possible dos attack vector within bash.

2012-03-20 Thread dethrophes
Am 20.03.2012 17:47, schrieb Eamonn Smyth: Without sounding alarmist, I can break my machine using bash. I also have a fix. I shall be officially releasing the c code this weekend at the hackathon london. As my code following correctly implements the logic the dos attack vector is negated. The

Re: Saving command history for non-interactive shell

2012-03-19 Thread dethrophes
Am 19.03.2012 13:39, schrieb Greg Wooledge: On Fri, Mar 16, 2012 at 06:15:35PM -0400, Chet Ramey wrote: There is nothing stopping you from using history in a non-interactive shell -- it's just not enabled by default. Turn on history with `set -o history' and set HISTFILE and HISTSIZE as you lik

Re: Saving command history for non-interactive shell

2012-03-17 Thread dethrophes
Am 17.03.2012 22:10, schrieb dethrophes: Am 16.03.2012 15:56, schrieb Greg Wooledge: On Fri, Mar 16, 2012 at 02:33:35PM +, Lars Peterson wrote: Is there a way to configure bash so that commands from a non-interactive shell are preserved in the history? I'm more interested in s

Re: Saving command history for non-interactive shell

2012-03-17 Thread dethrophes
Am 16.03.2012 15:56, schrieb Greg Wooledge: On Fri, Mar 16, 2012 at 02:33:35PM +, Lars Peterson wrote: Is there a way to configure bash so that commands from a non-interactive shell are preserved in the history? I'm more interested in saving commands invoked via ssh vs shell scrpts. From C

Re: [bug] Home dir in PS1 not abbreviated to tilde

2012-03-13 Thread dethrophes
Am 13.03.2012 18:13, schrieb Andreas Schwab: dethrophes writes: the missing "" in the case isn't redundant. i.e. case "$HOME" in The word is not subject to word splitting and filename expansion, so there is no need to quote. Andreas. Ok thanks for clarifying that.

Re: [bug] Home dir in PS1 not abbreviated to tilde

2012-03-13 Thread dethrophes
Am 13.03.2012 17:53, schrieb Eric Blake: On 03/13/2012 09:47 AM, dethrophes wrote: Am 13.03.2012 16:42, schrieb Eric Blake: On 03/13/2012 09:27 AM, Eric Blake wrote: Be aware that both approaches will misbehave if HOME is a root directory (/ or //), where you _don't_ want to strip tra

Re: [bug] Home dir in PS1 not abbreviated to tilde

2012-03-13 Thread dethrophes
Am 13.03.2012 16:42, schrieb Eric Blake: On 03/13/2012 09:27 AM, Eric Blake wrote: Be aware that both approaches will misbehave if HOME is a root directory (/ or //), where you _don't_ want to strip trailing slashes. So you really want: case $HOME in *[^/]* ) HOME=${HOME%${HOME##*[^/]}} ;;

Re: [bug] Home dir in PS1 not abbreviated to tilde

2012-03-13 Thread dethrophes
Am 13.03.2012 16:27, schrieb Eric Blake: On 03/13/2012 09:18 AM, Roman Rakus wrote: as a workaround to your problem you could have something like this in your bashrc if shopt extglob&>/dev/null ; then HOME="${HOME/%+(\/)}" # strip all trailing forward slashes else while [ "${HOME}" !=

Re: [bug] Home dir in PS1 not abbreviated to tilde

2012-03-13 Thread dethrophes
Am 13.03.2012 16:18, schrieb Roman Rakus: On 03/13/2012 04:08 PM, dethrophes wrote: Am 13.03.2012 06:04, schrieb Clark J. Wang: On Mon, Mar 12, 2012 at 12:22, Yongzhi Pan wrote: Tested in GNU bash, version 3.00.16(1)-release and 4.1.2(1)-release. Upon login, home dir is displayed as tilde

Re: [bug] Home dir in PS1 not abbreviated to tilde

2012-03-13 Thread dethrophes
Am 13.03.2012 06:04, schrieb Clark J. Wang: On Mon, Mar 12, 2012 at 12:22, Yongzhi Pan wrote: Tested in GNU bash, version 3.00.16(1)-release and 4.1.2(1)-release. Upon login, home dir is displayed as tilde in PS1: pan@BJ-APN-2 ~$ echo $PS1 \[\033[35m\]\u@\h \w$ \[\033[0m\] pan@BJ-APN-2 ~$ pwd

Re: Can somebody explain to me what u32tochar in /lib/sh/unicode.c is trying to do?

2012-03-11 Thread dethrophes
Am 11.03.2012 00:02, schrieb dethrophes: Am 10.03.2012 23:17, schrieb Chet Ramey: On 3/7/12 12:07 AM, John Kearney wrote: You really should stop using this function. It is just plain wrong, and is not predictable. It may enocde BIG5 and SJIS but is is more by accident that intent. If you

Re: Can somebody explain to me what u32tochar in /lib/sh/unicode.c is trying to do?

2012-03-10 Thread dethrophes
Am 10.03.2012 23:17, schrieb Chet Ramey: On 3/7/12 12:07 AM, John Kearney wrote: You really should stop using this function. It is just plain wrong, and is not predictable. It may enocde BIG5 and SJIS but is is more by accident that intent. If you want to do something like this then do it pro

Re: Please remove iconv_open (charset, "ASCII"); from unicode.c

2012-03-10 Thread dethrophes
Am 10.03.2012 22:22, schrieb Chet Ramey: On 3/6/12 11:47 PM, John Kearney wrote: Hi chet can you please remove the following from the unicode.c file localconv = iconv_open (charset, "ASCII"); Yeah, that was a typo. It should be iconv_open ("ASCII", "UTF-8"); as originally in gnulib/coreutils.

Re: Problem with overridden functions and BASH_SOURCE Array

2011-12-19 Thread dethrophes
> The difference between main1 and main2 is the fact that bash always reads > an entire command before executing any of it, and the if statement is a > compound command. Ok that insight gives me a way to work around the problem thanks. > I will have to see if the function definition can do a b

Problem with overridden functions and BASH_SOURCE Array

2011-12-14 Thread dethrophes
Configuration Information [Automatically generated, do not change]: Machine: i686 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='ba