Re: error message lacks useful debugging information

2023-10-05 Thread Dave Cigna via Bug reports for the GNU Bourne Again SHell
I want to thank all of you for taking this issue seriously. I'm sure you all agree that when something fails, the error message should provide useful information about what went wrong. If bash simply doesn't have the information because the kernel didn't provide it, then perhaps I should throw

error message lacks useful debugging information

2023-10-04 Thread Dave Cigna via Bug reports for the GNU Bourne Again SHell
From: daveci...@misguidedmonkey.net To: bug-bash@gnu.org Subject: error message lack useful debuggong information Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -fstack-protector-strong -Wformat -Werror=f

Re: BASH_XTRACEFD=1 read variable stdout flushing?

2023-01-16 Thread Dave Drambus
Thanks for the explanation and the help! On Mon, Jan 16, 2023 at 1:53 PM Chet Ramey wrote: > On 1/16/23 12:36 PM, dave.dram...@gmail.com wrote: > > Configuration Information [Automatically generated, do not change]: > > Machine: x86_64 > > OS: linux-gnu > > Compiler: gcc > > Compilation CFLAGS:

BASH_XTRACEFD=1 read variable stdout flushing?

2023-01-16 Thread dave . drambus
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall uname output: Linux sulfur 5.15.0-5

Cygwin bash build- command substitution fails

2019-12-17 Thread Dave Taylor
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: cygwin Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash.exe' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='cygwin' -DCONF_MACHTYPE='x86_64-unknown-cygwin' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPA

Re: Could bash do what make does?

2016-12-06 Thread Dave Finlay
There is an onus on you to use the appropriate mailing list. Bug-bash isn't for make-ing your case, bug-bash is for the bugs. Dave Finlay On Dec 6, 2016 15:44, "Robert Durkacz" wrote: On 6 December 2016 at 00:19, Greg Wooledge wrote: > what evidence? > ​ [for shell sc

Re: Could bash do what make does?

2016-12-02 Thread Dave Finlay
ou didn't deal with. I hope this response was of benefit to you. Dave Finlay On Fri, Dec 2, 2016 at 2:29 AM, Robert Durkacz wrote: > I agree that is the first step to take, but I am supposing that, since > build systems are a big business, some extensions to bash would be worth >

Re: copy

2016-02-25 Thread Dave Finlay
st'; mkdir -p "${dest_dir}" && find . -type f -mtime +10 -name "*.txt" -exec cp --preserve {} "${dest_dir}" \; Dave Finlay On Thu, Feb 25, 2016 at 5:41 PM, Val Krem wrote: > Hi, > > I want to copy files which are older than 10 days with the ex

Re: bug when 'cd ..' to a directory who's parent has been deleted

2016-02-08 Thread Dave Rutherford
easonable than anything else? It references a >> path that doesn't exist. > Um...Not exactly. As long as there's a handle open to the previous path, > it still exists (at least on linux and unix). Really? 11:40:24 dave@Vger:~$ mkdir -p a/a 11:40:30 dave@Vger:~$ cd a/a [remove a in another window] 11:40:49 dave@Vger:~/a/a$ touch file touch: cannot touch ‘file’: No such file or directory

Re: Future date

2016-01-24 Thread Dave Rutherford
On Sun, Jan 24, 2016 at 5:30 PM, Val Krem wrote: > I am trying to get a variable that combines the next month(Feb) and current year (2016) from the current date [...] > temp_date=$(date | awk -F ' ' '{print $2,$6}' | tr -d ' ') Wow, that's overkill. You don't need the -F ' ' options to awk, sin

Re: why must bash zap last search string just because we hit ^C?

2015-10-17 Thread Dave Rutherford
On Sat, Oct 17, 2015 at 11:19 PM, 積丹尼 Dan Jacobson wrote: > > "DW" == Dennis Williamson writes: > > DW> Or just open a new terminal rather than interrupting an in-progress > search. > > I am on a device where opening a new terminal is a lot of trouble. > Can you run gnu screen? ^A-c will ge

Re: remaking bash, trying static, glibc refuses static...?

2015-08-20 Thread Dave Rutherford
On Wed, Aug 19, 2015 at 5:55 PM, Linda Walsh wrote: [cut a lot about dynamic linking and the linux kernel] > Even bash can load many of it's builtin's dynamically -- but if they > aren't there, it could use the same named-programs -- and I don't > think it "falls-over" and dies if it can't dynamic

Re: Bug, feature or just the correct behaviour (stat'ing -bash down the PATH)

2015-06-03 Thread Dave Rutherford
the case where /usr/bin/-bash exists and is executable? > If one of the directories in the PATH is on an NFS server that is > 'down' then bash hangs - which disables a shell which would otherwise > be usable. It is ironic yet somehow appropriate that a fusion energy center should be having such a 1997 sort of problem today. But truly, my sympathies. :-) Dave

Re: eval a=b\ c

2015-05-27 Thread Dave Yost
OK, I can make it to work in bash if I say echodo a=b\\ c but then zsh tries to execute c. Can’t win. The problem is: how do I write this function so that it can be invoked identically in zsh and bash with identical results of setting a variable to a value with a space in it? > On 2015-05-26,

eval a=b\ c

2015-05-25 Thread dave
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/bash/

Re: [Bug-readline] Problem with CTRL-z and readline()

2015-03-02 Thread Dave Wysochanski
On Sun, 2015-03-01 at 20:14 -0500, Chet Ramey wrote: > On 2/27/15 12:10 PM, Dave Anderson wrote: > > > > This issue was first reported with respect to the crash utility, > > which is an interactive program that uses the readline library. > > > > The problem oc

Re: Memory leak in wait

2015-03-02 Thread Dave Rutherford
On Mon, Mar 2, 2015 at 2:33 AM, Jean Delvare wrote: > Which brings another question: is there any plan to implement sleep as > a bash builtin? It's already available as a loadable builtin (examples/loadables/sleep.c).

Re: Tab completion breaks for tilde-paths with filenames containing space

2015-01-14 Thread Dave Rutherford
On Wed, Jan 14, 2015 at 10:14 AM, Eduardo A. Bustamante López wrote: > Can you test with: > bash --norc --noprofile -i It is working in this case. The difference seems to be in direxpand. $ shopt -s direxpand; shopt direxpand direxpand on $ vi ~/a/a\ [nothing] $ shopt -u direxpand

Re: Tab completion breaks for tilde-paths with filenames containing space

2015-01-14 Thread Dave Rutherford
On Wed, Jan 14, 2015 at 9:45 AM, Eduardo A. Bustamante López wrote: > On Wed, Jan 14, 2015 at 09:33:31AM -0500, d...@evilpettingzoo.com wrote: > [...] >> Bash Version: 4.2 >> Patch Level: 37 Also tested on 4.3.30 > [dualbus@dualbus ~]$ mkdir a; >a/a\ a.txt You didn't create any ambiguity there.

Tab completion breaks for tilde-paths with filenames containing space

2015-01-14 Thread dave
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-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKA

Re: bash-2.05b-013 appears to not work

2014-10-17 Thread Dave Kalaluhi
Awesome - Thanks everyone for the help! I will forward these responses on to the security group. But again, Thank you everyone!!! -Dave On 10/17/14, Andreas Schwab wrote: > Eric Blake writes: > >> The following is a better test for whether CVE-2014-7187 can be >> exploited

Re: bash-2.05b-013 appears to not work

2014-10-17 Thread Dave Kalaluhi
quot; If we run the test via ssh, it is showing patched, however locally is still showing vulnerable. Thanks Eric, Dave On 10/16/14, Chet Ramey wrote: > On 10/16/14, 5:02 PM, Dave Kalaluhi wrote: >> We have been compiling some of the older versions of bash to fix >> vulnerab

bash-2.05b-013 appears to not work

2014-10-16 Thread Dave Kalaluhi
We have been compiling some of the older versions of bash to fix vulnerabilities, and for the most, has been working. However, when we patch the 013 patch for CVE-2014-7187, and run the nested loop, it's still showing as vulnerable. Has anyone else had a similiar experience? Thanks for the help,

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-06 Thread Dave Rutherford
On Tue, Oct 7, 2014 at 2:25 AM, Dave Rutherford wrote: **it.. sorry for the fat finger post. Gmail puts the tiny formatting options right next to the big SEND button. Ratzen fracken.

Re: bash uses tmp files for inter-process communication instead of pipes?

2014-10-06 Thread Dave Rutherford
On Tue, Oct 7, 2014 at 2:07 AM, Linda Walsh wrote: > > > Pierre Gaston wrote: > >> >> b=<<<$a is not doing anything so I wonder how much value this example has. >> > --- > I wondered about that.. think that was meant to be the > b=<<<($a) w/o the copy that greg said was pointless. > >> >> A pipe

Re: test for "command not found" before expanding shell parameters

2014-04-23 Thread Dave Finlay
, but it was enjoyable seeing the unintended consequences when replace other, more used commands. function greo() { wild="$@" if $(which "${FUNCNAME[0]}" > /dev/null); then $(which "${FUNCNAME[0]}") $wild fi } Dave Finlay On Tue, Apr 22, 2014 a

Re: bash-4.3 bug report

2014-04-14 Thread Dave Rutherford
On Mon, Apr 14, 2014 at 12:22 PM, David Binderman wrote: > Anyone experienced looking at the code will always need to examine it > more closely to find out why it's a good idea in this case to use an array > index and *then* sanity check it's value. But in this case it's a limiting check, not a b

Re: When a hashed pathname is deleted, search PATH

2014-03-17 Thread Dave Rutherford
it would extract on every command lookup. Only on commands that were found in the hash table, correct? This is not a minor performance hit, but a trivial one. Consider this my vote for checkhash as the default. Dave

typo in bash manual

2014-03-01 Thread Dave Yost
In http://www.gnu.org/software/bash/manual/bashref.html#GNU-Parallel Where you say ls *.gz | parallel -j+0 "zcat {} | bzip2 >{.}.bz2 && rm {}" This will recompress all files in the current directory with names ending in .gz using bzip2, running one job per CPU (-j+0) in parallel. it should be ls

RFE: a way to echo the arguments with quoting

2014-03-01 Thread Dave Yost
I have an ugly function I wrote for zsh that does this: Sat 14:17:25 ip2 yost /Users/yost 1 634 Z% echo-quoted xyz \$foo 'a b c ' '\n' xyz '$foo' 'a b c ' '\n' Sat 14:17:53 ip2 yost /Users/yost 0 635 Z% It would be nice if there were an easy way to do this in bash. Here is my use case: echo-c

Re: How to test if a link exists

2013-06-26 Thread Dave Gibson
Mark Young wrote: > A little off topic but are -a and -e identical? As file existence tests, yes. -a also serves as logical "and".

Re: How to test if a link exists

2013-06-23 Thread Dave Gibson
Mark Young wrote: > Hi, > > I stumbled into discovering that the -e test for a file does not > report the file as existing if the file is a dead symbolic link. It's documented in the bash manpage under "CONDITIONAL EXPRESSIONS". Unless otherwise specified, primaries that operate on files fol

Re: corrupted input after size function (input that's not recorded by bash)

2013-06-14 Thread Dave Gibson
Linda Walsh wrote: > > I have a small function in my bashrc: > > function showsize () {\ > local s=$(stty size); local o="(${s% *}x${s#* })"; s="${#o}";\ > echo -n $o; while ((s-- > 0));do echo -ne "\b"; done; \ > } > export -f showsize > trap showsize SIGWINCH > --- > That has the effect of

Re: [PATCH] Adding support for '--' in builtin echo's option parsing.

2013-04-01 Thread Dave Rutherford
On Mon, Apr 01, 2013 at 03:16:07PM +0300, Hemmo Nieminen wrote: > > Description: > > Currently it seems to be impossible to e.g. print "-n" with the > > builtin > > echo witout any extra characters. > > You should use printf instead. The echo command is a historical artifact > wh

Re: Behavior of calling return from a trap

2012-04-10 Thread dave reisner
fails, triggering the > error trap again. The second time you call it, you're not executing in a > function context, and `return' throws an error. Ah, of course. That makes a lot of sense. Thanks for clarifying. dave

Behavior of calling return from a trap

2012-03-28 Thread dave reisner
y error being thrown or if I shouldn't be expecting the trap to work as it is when it's declared outside of a function. Regards, Dave

bash 3.2 vs 3.0

2012-01-05 Thread Dave
mp/test Turning off errtrace Execution continues Turning on errtrace Next command will fail in bash3.2 26 echo_ /tmp/test 42 main /tmp/test 42 main /tmp/test root@atmwsnfd:/# echo $BASH_VERSION 3.2.51(1)-release root@atmwsnfd:/# Could anyone point me in correct direction on this one ? Regards Dave

Issue with errtrace

2012-01-05 Thread Dave
mp/test Turning off errtrace Execution continues Turning on errtrace Next command will fail in bash3.2 26 echo_ /tmp/test 42 main /tmp/test 42 main /tmp/test root@atmwsnfd:/# echo $BASH_VERSION 3.2.51(1)-release root@atmwsnfd:/# Could anyone point me in correct direction on this one ? Regards Dave

Re: How to run something before invoking the inputted command?

2010-07-12 Thread Dave Rutherford
On Mon, Jul 12, 2010 at 08:16, Greg Wooledge wrote: >> On Sat, Jul 10, 2010 at 11:30 AM, Eric Blake wrote: >> > Not quite before the command, but it is very easy to include $(date) as >> > part of PS1 to have a timestamp listed in the prompt that is printed >> > after every command. > > On Sat, J

Re: Failed bash -r command returns 0 exit status

2010-05-24 Thread Dave Rutherford
On Mon, May 24, 2010 at 08:32, Greg Wooledge wrote: > On Mon, May 24, 2010 at 04:25:48AM -0400, Dave Rutherford wrote: >> On Mon, May 24, 2010 at 02:48, Pitt, David wrote: >> >        status. This is not expected (at least not by me!). Zero exit >> > status is returne

Re: Failed bash -r command returns 0 exit status

2010-05-24 Thread Dave Rutherford
y list of commands, e.g. "/bin/ls && :". That one would, since the second command is 'true'. Replace it with 'false' and you should see an exit status of 1. As for "/bin/ls && /bin/ls", since neither command runs neither one fails, either. 'Tis a bit of a head-scratcher, though. Dave

Re: undefined reference to `__strtoll'

2010-02-12 Thread Dave Moore
Bob, I didn't read this carefully -- should I try the patch you suggested before we do anything else? -dave On Thu, Feb 11, 2010 at 16:43, Bob Proulx wrote: > Greg Wooledge wrote: > > Dave Moore wrote: > > > Machine: hppa2.0w > > > OS: hpux11.00 > > >

Re: undefined reference to `__strtoll'

2010-02-12 Thread Dave Moore
How do I configure the linker to use the system linker instead of gnu LD? I really appreciate the replies! -dave On Thu, Feb 11, 2010 at 15:49, Greg Wooledge wrote: > On Thu, Feb 11, 2010 at 12:58:46PM -0500, Dave Moore wrote: > > Machine: hppa2.0w > > OS: hpux11.00 &g

Re: undefined reference to `__strtoll'

2010-02-12 Thread Dave Moore
Hi, So how do I compile the 32-bit version of bash? Should I uninstall the GCC compiler I have and goto 3.4.6 like an earlier poster? -dave On Thu, Feb 11, 2010 at 16:43, Bob Proulx wrote: > Greg Wooledge wrote: > > Dave Moore wrote: > > > Machine: hppa2.0w &

undefined reference to `__strtoll'

2010-02-11 Thread Dave Moore
00 Configured with: ../src/configure --enable-languages=c,c++ --prefix=/usr/local/pa20_64 --with-local-prefix=/usr/local/pa20_64 --with-gnu-as --with-as=/usr/local/pa20_64/bin/as --with-gnu-ld --with-ld=/usr/local/pa20_64/bin/ld --disable-shared --disable-nls --host=hppa64-hp-hpux11.00 Thread model: single gcc version 4.0.0 Any help appreciated, -dave

Re: how to start in "overwrite-mode"

2009-10-28 Thread Dave Rutherford
e insert key before each PS1 prompt, putting that line into overwrite. If the user drops down to a PS2, etc. prompt, that line will be in insert mode. I didn't solve that; putting a ^E into PS* didn't work for some reason. (Why?) Dave

Re: bash accepts script with incorrect syntax and goes into infinite loop

2009-10-09 Thread Dave B
On Friday 09 October 2009, Pierre Gaston wrote: > > Well, it seems to me (and as stated in the bug report) that a "do" should > > follow the "while read NAME;". > > the while syntax is like this: > "while list; do list; done" > and the manual says "A sequence of one or more newlines may appear in

Re: bash accepts script with incorrect syntax and goes into infinite loop

2009-10-09 Thread Dave B
On Friday 09 October 2009, Pierre Gaston wrote: > > Repeat-By: > >printf '%s\n%s\n' foo bar | while read NAME; > >echo NAME=$NAME > >do > >echo blah > >done > > Not sure what is the incorrect syntax, and it seems normal that it goes > into an infinite lo

Re: Real easy questions. Please answer

2009-09-25 Thread Dave B
On Friday 25 September 2009 05:24:04 eatsubway wrote: > sry i have a stupid question. > > I have a variable and need to know how many items are in it. > > for example: > variable="abc xyz foo" > what program can i call to print out 3 > > right now im doing this... > > Counter() > { > echo $#

Re: Bug in array populating does not respect quotes

2009-09-24 Thread Dave B
On Thursday 24 September 2009 16:38:12 David Martin wrote: > Description: > When populating an array from a string in a variable does not > handle quotes. > > Repeat-By: > > ~$ declare -a samplearray > ~$ samplearray=( x y 'z k') > ~$ echo ${samplearray[2]} > z k > ~$ samplestring="x y 'z

Re: Bash script file naming problem?

2009-07-25 Thread Dave B
On Saturday 25 July 2009, michael rice wrote: > Is there a problem with naming a bash script file "script"? I'm using > Fedora 11. "script" is most likely the name of a command installed on your system (on mine, it's /usr/bin/script). Try "man script" and see. So if you really want to call your s

Re: 'time' redirection, and pipe redirections in general

2009-07-25 Thread Dave B
On Saturday 25 July 2009, Linda Walsh wrote: > AFAIK, I'm still screwed if I want to create more than one > pipe for outputs -- either sending stderr to one pipe and stdout to > another, OR a way of even doing what "tee" does, but built into the > shell, so I could, using the building "tee", a f

Re: regarding 'time' builtin

2009-07-17 Thread Dave B
On Friday 17 July 2009, Linda Walsh wrote: > where does the output from the 'time' command "go" > > I.e. if I wanted to pipe the output to a prog or file, how would I > go about doing it? Please see http://mywiki.wooledge.org/BashFAQ/032 -- D.

Re: Possible Feature Requests (unsource, exchange)

2009-07-07 Thread Dave B
On Tuesday 07 July 2009, Christopher Roy Bratusek wrote: > Hi all, > > what I'm currently missing are the following two things (I'm not 100% > sure if they are not available): > > unsource: the opposite of source (while source is making functions > publically available, unsource would remove them)

Re: $\n doesn't get expanded between double-quotes

2009-07-03 Thread Dave B
On Friday 03 July 2009, Richard Neill wrote: > > X=$'a\nb c' > > This is still a missing feature: how to embed newlines in double-quoted > bash string assignment: > > For example, if I want to write: > > EMAIL_BODY="Dear $NAME,$'\n\n'Here are the log-files for > $(date)$'\n\n'Regards,$'\n\n'$SENDE

Re: IFS valid characters

2009-03-16 Thread Dave B
Stephane CHAZELAS wrote: > 2009-03-10, 15:43(-04), Chet Ramey: >>> What are the valid charactes for the IFS variable? In particular, is '\0' a >>> valid one? >> Technically, yes, but in practice it's not useful. There are too many things >> represented as C strings to make NUL work right. > [..

Re: Creating directories with sticky bit set

2009-03-13 Thread Dave Rutherford
c -Wall sticky.c -o sticky.o $ gcc -shared sticky.o -ldl -lstdc++ -o sticky.so --- running $ export LD_PRELOAD=$PWD/sticky.so:$LD_PRELOAD --- for long-term use, add to bash startup files How portable this is I don't know, but I tested it briefly and it seems okay; YMMV. Dave

Re: No tilde expansion right after a quotation

2009-02-16 Thread Dave B
Angel Tsankov wrote: > Eric Blake wrote: >> According to Angel Tsankov on 2/15/2009 3:02 PM: >>> I tried CPATH="${CPATH}${CPATH:+:}"~usr1/blah/blah. (I quote >>> expansions just to be on the safe side, though I think home >>> directories may not contain spaces.) >> There are some contexts, such as

Re: Howto set a Readline variable (not in the init file!)?

2009-01-12 Thread Dave B
Andi Bachmann wrote: > Hello > > I'm looking for a way to set a Readline variable, but without editing > the init (~/.inputrc or /etc/inputrc) file. > > E.g., I'd like to have > >set show-all-if-ambiguous on > > The thing is that I have to login to some remote server with a login > that I

Re: $(grep anycommand anyfile) fail

2008-12-24 Thread Dave B
BlackEnvil wrote: > Description: using ` ` or $() with command that use dirnames with spaces > fail. > > there are diferent dirnames with this problem, and different situations that > cause these errors, not only with ls and not only with grep. > > bye > > > Repeat-By: > > [blacken...@space_s

Re: Formating variable with caracter and date.

2008-12-12 Thread Dave B
Dolphin06 wrote: > Hello all, > > I would like to give a variable a value which have a format like this one: > <3 letters>-- > should be yymmdd. Date of the day by default. > How would i do this, i know the date command is date +"%y-%m-%d", but i dont > know the syntax for mixing letters date a

Re: Maximum limit of pipes in a single command ?

2008-08-28 Thread Dave B
Keshetti Mahesh wrote: > Hi all, > > Can anyone tell me what is the maximum limit of number of pipes > that can be opened through a single command ? > > e.g; # ||| .| For what is worth, on my system (bash 3.2.33(1)-release) I can have 3332 pipes before bash give

Re: Equivalent of ksh, zsh {N}<[WORD] ?

2008-08-26 Thread Dave B
Pierre Gaston wrote: >> I think he refers to the fact that, with ksh, you can do for instance >> >> $ exec {fd}<&0 >> $ echo $fd >> 10 >> $ exec {fd1}<&0 >> $ echo $fd1 >> 11 >> >> I didn't try on zsh, but with bash you get: >> >> $ exec {fd}<&0 >> -bash: exec: {fd}: not found >> > ah sorry I didn

Re: Equivalent of ksh, zsh {N}<[WORD] ?

2008-08-26 Thread Dave B
Pierre Gaston wrote: >> > On Tue, Aug 26, 2008 at 5:41 AM, R. Bernstein <[EMAIL PROTECTED]> wrote: >> > > Both zsh and ksh have a way to open a file or duplicate a file >> > > descriptor and let the interpreter pick the descriptor saving the >> > > newly-allocated file descriptor number in a v

Re: 'read' primitive

2008-08-22 Thread Dave B
Bob Proulx wrote: > To get the entire line verbatim you would need to use the $REPLY > variable. Or also use IFS= read -r foo < bar -- D.

Re: How to create parameterized aliases in bashrc

2008-07-26 Thread Dave B
Aman Jain wrote: > Hi > > I would like to create an alias to show Nth line of a file. > > I tried something like > alias shline='head -$1 $2 | tail -1' #$1 is the line number and $2 > is the filename ># Usage should be : > $shline 5 fi

Re: Regular expression match operation with character classes fails in bash 3.2

2008-06-28 Thread Dave B
John E. Wulff wrote: > I have just updated from "openSUSE 10.2" to openSUSE 11.0" Linux. My > backup shell script > is now broken. I tracked the problen down to the latest version of > "bash". > > The relatively new binary operator =~ does not match a regular > expression which con

Re: Strange return codes of continue

2008-06-27 Thread Dave B
Roman Rakus wrote: > This is realy strange. I have two examples > First: > > while [ 1 ]; do > while [ 1 ]; do > continue 0 > done > done > echo $? > > > Second: > > while [ 1 ]; do > while [ 1 ]; do > continue 0 > done > echo $? > done > echo $? > > In first case I have ech

Re: [[ ... =~ ... ]] is broken when RHS is quoted

2008-06-22 Thread Dave B
Alexis Huxley wrote: > "Quote removal" means that, as usual, quotes do not form part of the > arguments, they merely serve to delimit the arguments, I take it. > "Words between [[ and ]] ... quote removal performed" means on *all* > words between [[ and ]] I take it. Hmm ... No, that can't be rig

Re: [[ ... =~ ... ]] is broken when RHS is quoted

2008-06-22 Thread Dave B
Alexis Huxley wrote: > Description: > [[ ... =~ ... ]] is broken when RHS is quoted AFAICT that seems to have changed from 3.2alpha. According to the changelog, from version 3.2alpha, "Quoting the string argument to the [[ command's =~ operator now forces string matching, as with the other

Missing .bash_history Entries

2008-05-24 Thread Dave Jarvis
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='l$ uname output: Linux jaguar 2.6.24-16-generic #1 SMP Thu Apr 10 12:47:45 UTC 200$ Machine Type: x86_64-pc-l

Re: unexpected behavior of 'read' builtin

2008-05-24 Thread Dave B
On Saturday 24 May 2008 02:44, Juliano F. Ravasi wrote: > Description: > > I got bitten by two unexpected (and undocumented) behaviors of > the 'read' builtin. > > The first one is that it doesn't seem to handle word separators > equally, making distinction when spaces and non-space > separators

Re: Bash messes up spaces in command line agruments.

2008-05-07 Thread Dave B
On Wednesday 7 May 2008 14:54, Dave B wrote: > $ ./startup ' some words ' > 1 > 0 |./startup| > 0 |./startup| > 1 |some words | > 1 | some words | > # ' some words ' This

Re: Bash messes up spaces in command line agruments.

2008-05-07 Thread Dave B
On Tuesday 6 May 2008 16:20, Herrmann, Justin wrote: > Description: When I try to pass strings inside double or single quotes > as command line arguments to my Bash script, leading spaces, trailing > spaces, and multiple grouped embedded spaces are removed from the > string. This also prevents me

Re: finding the index at which two strings differ

2008-05-07 Thread Dave B
On Tuesday 6 May 2008 22:33, Dave B wrote: > while [ $i -le $((${#a}-1)) ] && [ $i -le $((${#b}-1)) ]; do while [ $i -lt ${#a} ] && [ $i -lt ${#b} ]; do -- D.

Re: finding the index at which two strings differ

2008-05-06 Thread Dave B
On Tuesday 6 May 2008 21:29, Bob Proulx wrote: > I can't think of any way to do this natively in bash Well, there's a loop solution, but it's a bit awkward: a=help; b=hello; i=0 while [ $i -le $((${#a}-1)) ] && [ $i -le $((${#b}-1)) ]; do if [ "${a:${i}:1}" = "${b:${i}:1}" ]; then i=$((i+

Re: at which byte do two strings differ

2008-05-06 Thread Dave B
On Tuesday 6 May 2008 07:53, Nathan Coulter wrote: > Looking for a simple ways to output the byte at which two strings differ. > Here is one: > > cmp <(echo "hello") <(echo "help") | cut -d' ' -f5 | tr -d , > > Any other suggestions? I can't see how this pertains to gnu.bash.bug, however try t

Re: for ... in ... do ignores escape characters

2008-04-18 Thread Dave Rutherford
o hewlett packard; } Now note the difference between: $ for w in "`foo`"; do echo $w; done sony apple hewlett packard and $ for w in `foo`; do echo "$w"; done sony apple hewlett packard and $ for w in "`foo`"; do echo "$w"; done sony apple hewlett packard Why the first one does that I'm not sure, but it's the last one you want. Dave

Re: converting an array into a single variable

2008-02-20 Thread Dave Rutherford
ages\///g' > echo $newfile > done; More complicated than it needs to be. ITEM=124534 imagelist=`cd www/images; echo $ITEM_*.JPG` if [ "$imagelist" = "$ITEM_*.JPG" ]; then imagelist=""; fi imagelist="${imagelist// /,}" Nothing but builtins. Dave

Re: Comparison failure

2008-01-10 Thread Dave Rutherford
Chet Ramey wrote: > Dave Rutherford wrote: > > Now, "[[" isn't very well documented, so I tend not to use it, > > I'm always interested in suggestions for improving the bash documentation. > Can you tell me what's unclear about the existing description

Re: Comparison failure

2008-01-10 Thread Dave Rutherford
t; 54 ]] > ++ echo -1 [...] > - Example trace 2 -> [...] > ++ [[ 1 < 109 ]] > ++ echo 2 [...] > ++ [[ 2 < 109 ]] > ++ echo -1 Regards, Dave

Re: reading whitespaces and beginning and end of line

2007-12-07 Thread Dave Rutherford
of cat" award, but even with that I can't reproduce your problem here. What version of bash are you using? $ cat -t -E test1 this $ file $ contains some $ extra^I$ whitespace $ $ while read; do echo "$REPLY" >> test2; done < test1 $ cat test1 | while read; do echo &q

Re: question and/or enhancement request

2007-07-29 Thread Dave Rutherford
from stdin eval `while read w; do echo "$w"; done` # (". -" would be better here... if it worked. # Also tried ". /dev/stdin" without luck.) rm pipe_to_bash pipe_to_prog # Dave ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash

Re: Subnet address

2007-07-21 Thread Dave Rutherford
x y y; do if [ "$w" = "inet" ]; then set -- ${x//./ }; a=${1#addr:}; b=$2; c=$3; d=$4; set -- ${y//./ }; w=${1#Mask:}; x=$2; y=$3; z=$4; echo $((a&w)).$((b&x)).$((c&y)).$((d&z)); break;

Re: Evaluate expression every time directory changes

2007-06-29 Thread Dave Rutherford
On 6/28/07, bash_user <[EMAIL PROTECTED]> wrote: Lets say I would like to update environment variable based on ${PWD} should I clobber my prompt generation routine or there is a better way. Something like this? PROMPT_COMMAND='eval NEWPWD=&qu

Re: How to detect bash?

2006-10-10 Thread Dave Rutherford
n't you know, if these systems are under your control? And why the heck do you think this is is *bug* in *bash*? Dave ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash

Re: How to detect bash?

2006-10-10 Thread Dave Rutherford
use the hash-bang and make SURE the shell is Bash. Dave ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash

Re: null command and parameter expansion for "Display error if null or unset"

2006-07-31 Thread Dave Rutherford
On 7/31/06, Paul Jarc <[EMAIL PROTECTED]> wrote: "Dave Rutherford" <[EMAIL PROTECTED]> wrote: > On 7/31/06, Poor Yorick <[EMAIL PROTECTED]> wrote: >> : ${FAKEVAR?} || echo hello > > Try this and then run your script: > > export FAKEVAR="

Re: null command and parameter expansion for "Display error if null or unset"

2006-07-31 Thread Dave Rutherford
. It would be a convenient and concise syntax for acting on unset variables. Try this and then run your script: export FAKEVAR="echo This could have been rm -rf $HOME" to see why not to do it this way. On the other hand, if you already know FAKEVAR is not set, why are yo

Re: PATH and $0

2006-07-11 Thread Dave Rutherford
t what you need. (It would be relatively easy in 'c'.) Even /proc/self/* doesn't contain the script's full pathname. Perhaps somebody else knows a better way. Dave ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash

Re: PATH and $0

2006-07-11 Thread Dave Rutherford
you want 'script.sh', use 'basename' or the Bash equivalent, which I think is '${0##*/}'. The canonical path would be a bit trickier. Dave ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash

core/loop vi mode when '.' used to repeat a replace

2006-03-10 Thread dave
Configuration Information [Automatically generated, do not change]: Machine: i386 OS: freebsd4.8 Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' -DCONF_OSTYPE='freebsd4.8' -DCONF_MACHTYPE='i386-unknown-freebsd4.8' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share/lo

Re: bash problem with #!, rev 2

2005-07-27 Thread Dave Yost
Thanks for your learned analysis. 1. I kind of like the way zsh handles it. 2. In any case, I'll use #!/usr/bin/env http://Yost.com/computers/compileAndGo 3. I'll change my pages to reflect the change by around noon 15:00 UTC+8. Thanks ag

bash problem with #!, rev 2

2005-07-26 Thread Dave Yost
anyone has used a shell script as a #! program?) Thanks Dave ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash

bash problem with #!

2005-07-26 Thread Dave Yost
is a program starting with #!/bin/bash Invoking a compileAndGo script works correctly in zsh, but not in bash, sh, ksh, csh, or tcsh. (Is this the first time anyone has used a shell script as a #! program?) Thanks Dave ___ Bug-bash mailing list

Re: bash feature request: pushd -v, popd -v

2005-07-15 Thread Dave Rutherford
sh 3.0 at that), but it seems to do what you want. popd would be very similar, of course. Dave ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash