Re: Only one Friday 13th coming in 2016

2015-12-22 Thread Ken Irving
On Tue, Dec 22, 2015 at 04:04:16AM +0100, Ángel González wrote: > Bill Duncan wrote: > > Remember that while there are 14 patterns of years, leap years don't > > impact Friday the 13th for January/February.. > > > > This isn't an exhaustive analysis, but a quick check for 300 years > > didn't show

Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?

2015-10-19 Thread Ken Irving
On Mon, Oct 19, 2015 at 12:49:25PM -0700, Linda Walsh wrote: ... > I observe similar inconsistencies and confusion around > the use of 'dynamic vars' -- not really being global, not really > being local, but supposedly on some dynamic frame, "somewhere", > but not anywhere they've been declared or

Re: Design question(s), re: why use of tmp-files or named-pipes(/dev/fd/N) instead of plain pipes?

2015-10-19 Thread Ken Irving
On Sun, Oct 18, 2015 at 07:36:49PM -0400, Chet Ramey wrote: > On 10/17/15 8:43 PM, Linda Walsh wrote: > > > > Chet Ramey wrote: ... > >> I think you're missing that process substitution is a word expansion > >> that is defined to expand to a filename. When it uses /dev/fd, it > >> uses pipes and

Re: Does [ -f FILE ] have a bug on testing a symlink ?

2015-02-09 Thread Ken Irving
On Mon, Feb 09, 2015 at 09:00:12PM +, Cheng Rk wrote: > > To bug-bash@gnu.org: > > According this documentation `help test`, I am expecting it should > return false on anything other than a regular file, > > -f FILETrue if file exists and is a regular file. > > but why it returned t

Re: Feature request - ganged file test switches

2014-08-13 Thread Ken Irving
On Wed, Aug 13, 2014 at 12:16:52PM -0400, Steve Simmons wrote: > > On Aug 12, 2014, at 4:36 PM, Chet Ramey wrote: > > > On 8/9/14, 7:07 AM, Steve Simmons wrote: > > > >> It would be nice to have ganged file test switches. As an example, to test > >> that a directory exists and is properly acce

feature request: apply parameter expansions to array keys

2013-12-15 Thread Ken Irving
No bug here, but I naively expected the pattern substitution expansion to work on array keys as well as values, e.g.: $ declare -A h $ h[foo]=x h[bar]=y $ # show keys and values: $ printf "\t<%s>\n" "${!h[@]}" "${h[@]}" $ # try to pad keys an

Re: feature request: file_not_found_handle()

2013-08-21 Thread Ken Irving
On Wed, Aug 21, 2013 at 12:21:11PM -0700, Eduardo A. Bustamante López wrote: > On Wed, Aug 21, 2013 at 08:39:53PM +0200, Andreas Gregor Frank wrote: > > Hello Greg, > > > > this is a feature request for no_such_file_or_directory_ > > handle(). I do not want to talk about missing quotes in anyone's

Re: feature request: file_not_found_handle()

2013-08-21 Thread Ken Irving
On Wed, Aug 21, 2013 at 08:10:50AM -0400, Greg Wooledge wrote: > On Wed, Aug 21, 2013 at 02:22:24AM -0800, Ken Irving wrote: > > $ cat $(ambler.method dispatch) > > #!/bin/bash > > method=$1 && shift > > test -n "$method" || exit >

Re: feature request: file_not_found_handle()

2013-08-21 Thread Ken Irving
On Tue, Aug 20, 2013 at 04:44:57PM +0200, Roman Rakus wrote: > You are badly using features of bash. Write a script which will do > things for you, or use any other language/shell. There's only one feature being used, a hook that bash calls in the event that a command is not found. The request i

Re: feature request: file_not_found_handle()

2013-08-18 Thread Ken Irving
On Sun, Aug 18, 2013 at 06:30:47PM -0700, Linda Walsh wrote: > > Chet Ramey wrote: > >On 8/14/13 7:44 AM, Andreas Gregor Frank wrote: > >>Hi, > >> > >>i think a file_not_found_handle() or a modified command_not_found_handle(), > >>that does not need an unsuccessful PATH search to be triggered, wou

Re: feature request: file_not_found_handle()

2013-08-18 Thread Ken Irving
On Sun, Aug 18, 2013 at 02:35:49PM -0400, Chet Ramey wrote: > On 8/14/13 7:44 AM, Andreas Gregor Frank wrote: > > Hi, > > > > i think a file_not_found_handle() or a modified command_not_found_handle(), > > that does not need an unsuccessful PATH search to be triggered, would be > > useful and cons

Re: feature request: file_not_found_handle()

2013-08-18 Thread Ken Irving
On Sat, Aug 17, 2013 at 01:46:16PM +0200, Andreas Gregor Frank wrote: > same reason for me: some object-oriented shell ( > http://oobash.sourceforge.net/) We're both running commands in the form 'object.method ...', and it works very naturally on the shell using the command-not-found hook. The pr

Re: feature request: file_not_found_handle()

2013-08-14 Thread Ken Irving
On Wed, Aug 14, 2013 at 01:44:08PM +0200, Andreas Gregor Frank wrote: > Hi, > > i think a file_not_found_handle() or a modified command_not_found_handle(), > that does not need an unsuccessful PATH search to be triggered, would be > useful and consistent. > > i found this old (Dec, 2009) discussi

Re: eval doesn't close file descriptor?

2013-02-12 Thread Ken Irving
On Tue, Feb 12, 2013 at 04:22:08PM -0500, Matei David wrote: > Generally speaking, it took me quite some time to figure out how to > properly create a "double pipe" without using any intermediate files or > fifos. The concept is very easy: in -> tee -> two parallel, independent > pipes -> join -> o

Re: typeset -p on an empty integer variable is an error. (plus -v test w/ array elements)

2013-01-14 Thread Ken Irving
On Mon, Jan 14, 2013 at 08:57:41PM +0100, John Kearney wrote: > ... > btw > || return $? > > isn't actually error checking its error propagation. Also btw, I think you can omit the $? in this case; from bash(1): return [n] ... If n is omitted, the return status is that of th

Re: Syntax Question...

2011-08-18 Thread Ken Irving
On Thu, Aug 18, 2011 at 10:13:45AM -0700, Linda Walsh wrote: >Um...the description from "<<<", above indicates it is...subject > to pathname expansion...If I had matching filesin my dir, it > expanded and returned them, > so I'm pretty sure it does PN expansion. As noted, you're being fooled

Re: Syntax Question...

2011-08-16 Thread Ken Irving
On Tue, Aug 16, 2011 at 03:41:19PM -0700, Linda Walsh wrote: > Ken Irving wrote: > >It seems to me that there are real bugs in applying set -e that can only > >be fixed by handling more special cases in the bash code,and those cases > >may vary for different scripts. &g

Re: Syntax Question...

2011-08-16 Thread Ken Irving
On Mon, Aug 15, 2011 at 08:19:01PM -0700, Linda Walsh wrote: > >>today_snaps="$('ls' -1 ${snap_prefix} 2>/dev/null |tr "\n" " " )" > > > >This one is so bad, I saved it for last. Ack! Pt! Wait, what? Why? > >What the? Huh? > ... > What would you do to search for files w/wild cards and return th

Re: Problem with open and rm

2011-03-16 Thread Ken Irving
On Wed, Mar 16, 2011 at 10:54:15AM +, Barrie Stott wrote: > The script that follows is a cut down version of one that came from elsewhere. > > #!/bin/bash > > cp /tmp/x.html /tmp/$$.html > ls /tmp/$$.html > [ "$DISPLAY" ] && open /tmp/$$.html > ls /tmp/$$.html > rm -f /tmp/$$.html > > I'm on

Re: Problem with how to assign an array

2011-02-24 Thread Ken Irving
On Thu, Feb 24, 2011 at 03:42:57PM -0500, Greg Wooledge wrote: > On Thu, Feb 24, 2011 at 02:55:13PM -0500, Steven W. Orr wrote: > > I have three arrays > > > > a1=(aaa bbb ccc ddd) > > a2=(qqq www eee rrr) > > a3=(fff ggg hhh) > > > > I then set a_all > > > > a_all=("${a1[*]}" "${a2[*]}" "${a3[*

Re: bash 'let' can give error

2010-12-10 Thread Ken Irving
On Thu, Dec 09, 2010 at 05:52:49PM +, Dominic Raferd wrote: > $ val=0; let val++; echo $val,$?; unset val > 1,1 > > see the error code 1. Setting any other start value (except > undefined) for val does not produce this error, the problem occurs > for let val++ and let val-- if the start value

Re: pathname expansion part two

2010-10-15 Thread Ken Irving
On Fri, Oct 15, 2010 at 01:13:33PM -0600, Bob Proulx wrote: > javajo91 wrote: > > "For example, if you wanted to list all of the files in the directories /usr > > and usr2, you could type ls /usr*. > > Because the '*' is a file glob. It is called a glob because it > matches a glob of characters.

Re: asking for a better way to implement this

2010-09-26 Thread Ken Irving
On Sun, Sep 26, 2010 at 06:15:57PM +0200, Christopher Roy Bratusek wrote: > Hi all, > > I'm writing a wrapper for rm, which does not let the file/directory be > removed, if > there's a .dirinfo file in the directory containing "NoDelete". > > (feel free to ask what that's all about.) > > This i

Re: Bash style of if-then-else?

2010-09-23 Thread Ken Irving
On Thu, Sep 23, 2010 at 04:38:42PM -0500, Michael Witten wrote: > On Mon, Aug 23, 2010 at 16:40, Eric Blake wrote: > > On 08/23/2010 03:29 PM, Peng Yu wrote: > >> > >> Hi, > >> > >> I'm wondering if there is a widely accepted coding style of bash scripts. > >> > >> lug.fh-swf.de/vim/vim-bash/Style

Re: function grammar

2010-07-19 Thread Ken Irving
On Mon, Jul 19, 2010 at 10:46:30AM +0200, Bernd Eggink wrote: > Am 19.07.2010 08:30, schrieb Ken Irving: > >On Sun, Jul 18, 2010 at 11:53:02AM -0700, Linda Walsh wrote: > >> > >>from man bash, to define a function use; > >> > >>"function" &qu

Re: function grammar

2010-07-18 Thread Ken Irving
On Sun, Jul 18, 2010 at 11:53:02AM -0700, Linda Walsh wrote: > > from man bash, to define a function use; > > "function" "name" > OR > "name" () > > right? > > And Compound Commands are: > > ( ) > { ; ) > (( expression )) > [[ expression ]] > ...et al > > so why do I get a syntax

Re: Standard .bashrc needs a minor fix

2010-05-08 Thread Ken Irving
On Fri, May 07, 2010 at 03:03:57PM -0400, Mike Frysinger wrote: > On Friday 07 May 2010 08:49:26 Greg Wooledge wrote: > > On Thu, May 06, 2010 at 09:30:20AM -0500, Chuck Remes wrote: > > > e.g. > > > [ -z "$PS1" ] && return > > > > That's certainly *not* how I'd write that check. If the goal is t

Re: Bash manual - interactive shell definition

2010-03-12 Thread Ken Irving
On Fri, Mar 12, 2010 at 11:57:41AM +0200, Pierre Gaston wrote: > On Fri, Mar 12, 2010 at 11:50 AM, Ken Irving wrote: > > > On Fri, Mar 12, 2010 at 09:16:05AM +, Marc Herbert wrote: > > > >> Could this sentence: > > > >> > > > >>

Re: Bash manual - interactive shell definition

2010-03-12 Thread Ken Irving
On Fri, Mar 12, 2010 at 12:50:26AM -0900, Ken Irving wrote: > On Fri, Mar 12, 2010 at 09:16:05AM +, Marc Herbert wrote: > > >> Could this sentence: > > >> > > >> "An interactive shell is one started without non-option arguments, > > >>

Re: Bash manual - interactive shell definition

2010-03-12 Thread Ken Irving
On Fri, Mar 12, 2010 at 09:16:05AM +, Marc Herbert wrote: > >> Could this sentence: > >> > >> "An interactive shell is one started without non-option arguments, > >> unless -sis specified, without specifying the > >> -c option, and whose input and error output are both connected to terminals >

Re: Bash manual - interactive shell definition

2010-03-12 Thread Ken Irving
On Thu, Mar 11, 2010 at 09:10:11AM -0500, Robert Cratchit wrote: > On page > > http://www.gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files > > Could this sentence: > > "An interactive shell is one started without non-option arguments, > unless -sis specified, without specifying the >

Re: Variable getopts lost

2010-02-23 Thread Ken Irving
On Tue, Feb 23, 2010 at 08:30:16PM +0100, Daniel Bunzendahl wrote: > ... > if [ !$LSEITE ]; then > LSEITE=$(pdfinfo $pdf | grep Pages: | sed -e 's/Pages:[[:space:]]//g') > echo "-l automatisch auf $LSEITE gesetzt" > fi > ... > > In the last if-loop LSEITE will be set if LSEITE isn't set. > This

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

2010-01-05 Thread Ken Irving
On Tue, Jan 05, 2010 at 08:23:39PM +0100, Andreas Schwab wrote: > Greg Wooledge writes: > > > On Mon, Jan 04, 2010 at 01:25:50PM +, Stephane CHAZELAS wrote: > >> >> da...@thinkpad ~/foo $ echo $PWD > >> >> /home/darkk/foo > > > >> Well, if I read > >> http://www.opengroup.org/onlinepubs/96999

Re: command_not_found_handle not called if "command" includes a slash

2009-12-29 Thread Ken Irving
On Tue, Dec 29, 2009 at 12:33:25PM -0900, Ken Irving wrote: > On Mon, Dec 28, 2009 at 03:24:33PM -0900, Ken Irving wrote: > > On Sat, Dec 26, 2009 at 12:54:47PM -0900, Ken Irving wrote: > > > Description: > > > I'm not sure this

Re: command_not_found_handle not called if "command" includes a slash

2009-12-29 Thread Ken Irving
On Tue, Dec 29, 2009 at 10:40:04PM +0100, Jan Schampera wrote: > 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

Re: command_not_found_handle not called if "command" includes a slash

2009-12-29 Thread Ken Irving
On Mon, Dec 28, 2009 at 03:24:33PM -0900, Ken Irving wrote: > On Sat, Dec 26, 2009 at 12:54:47PM -0900, Ken Irving wrote: > > Description: > > I'm not sure this is a bug, but I notice that the > > command_not_found_handle function is not called if the "com

Re: command_not_found_handle not called if "command" includes a slash

2009-12-28 Thread Ken Irving
On Sat, Dec 26, 2009 at 12:54:47PM -0900, Ken Irving wrote: > 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 sou

command_not_found_handle not called if "command" includes a slash

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

Re: have bg, fg, but lack stop

2009-12-21 Thread Ken Irving
On Sat, Dec 19, 2009 at 05:48:44PM -0900, Ken Irving wrote: > kill %1 works for me. I've puzzled over this before, and I think part of the > trouble may be that 'jobspec' is not defined in bash(1) (v 3.29). Ok, I misunderstood the issue, stop vs kill. Ken -- ken.irv...@alaska.edu

Re: have bg, fg, but lack stop

2009-12-21 Thread Ken Irving
On Sun, Dec 20, 2009 at 10:30:27AM +0800, jida...@jidanni.org wrote: > Notice how I need two steps to stop this running job: > > $ jobs > [1]+ Running firefox & > $ fg > firefox > ^Z > [1]+ Stopped firefox > > As there is no > $ stop %1 > like command. kill %1 w

Re: Command substitution reduce spaces even in strings

2009-12-08 Thread Ken Irving
hort example: > > $ echo $(echo "'alfa beta'") > 'alfa beta' > > Instead of 'alfa beta' with double space. > > Repeat-By: > [Describe the sequence of events that causes the problem > to occur.] > > > $ echo $(echo "'alfa beta'") > 'alfa beta' > > Instead of 'alfa beta' with double space. $ echo "$(echo "'alfa beta'")" 'alfa beta' -- Ken Irving, ken.irv...@alaska.edu

Re: qwerty

2009-11-11 Thread Ken Irving
'm using BASH_VERSION 3.2.39, so please forgive me if this issue are > already fixed There's nothing to fix. It might help if you provide some markers in your test patterns so you can see where each argument begins and ends, e.g., $ printf "(%d) {%s}\n" 1 ok - (1)

Re: Bash script file naming problem?

2009-07-25 Thread Ken Irving
a command will be resolved. If you type: which script you'll likely see something other than what you're expecting. Ken -- Ken Irving, fn...@uaf.edu Water and Environmental Research Center Institute of Northern Engineering University of Alaska, Fairbanks

Re: Feature Idea: Enhanced Tab Completion

2009-03-21 Thread Ken Irving
ab to see history entries that start with it. This sounds a lot like what you get with the reverse-search-history command, bound to control-r (C-r), a great feature indeed. Ken -- Ken Irving, fn...@uaf.edu, 907-474-6152 Water and Environmental Research Center Institute of Northern Engineering University of Alaska, Fairbanks

Re: command not found magic

2009-01-12 Thread Ken Irving
ommand_not_found_handle"), change it here. */ -/* #define NOTFOUND_HOOK "command_not_found_handle" */ + default ("command_not_found_handler"), change it here. */ +/* #define NOTFOUND_HOOK "command_not_found_handler" */ -- Ken Irving, fn...@uaf.edu, 907-474-6152 Water and Environmental Research Center Institute of Northern Engineering University of Alaska, Fairbanks

Re: command not found on remote server

2008-12-11 Thread Ken Irving
making the script stronger when in reality > they are making it more fragile. More fragile because they are then > fixing the script into the rigid framework of a particular system. > That is the case I am frowning upon. I've often used hard-coded paths, and appreciate your argument and re

Re: how to know if a command was successful on remote server

2008-12-10 Thread Ken Irving
! /bin/bash > > #how can i get a returned value from this ? > ssh [EMAIL PROTECTED] remotescript param >From ssh(1): ssh exits with the exit status of the remote command or with 255 if an error occurred. Ken -- Ken Irving

Re: command not found magic

2008-12-04 Thread Ken Irving
about it. It needs a small > > change in bash. > > This will be in bash-4.0, with some improvements. Another wish-list item for that would be to pass the complete argument list to the handler. The current patch for this (in debian, same as ubuntu) only provides the failed command na

Re: "C-z bg" without the lurch

2008-11-25 Thread Ken Irving
ut lurching my CD burning job, even for a split second? It sounds like you're not running bash, you're running the cd burner application. Bash exec'd it like you asked it to and is no longer in the picture. If it supports C-Z, then maybe it can do what you want? -- Ken Irving

patch for bash 3.2 manpage parameter expansion operator summaries

2008-10-25 Thread Ken Irving
Configuration Information [Automatically generated, do not change]: Machine: i486 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='ba

Re: piping output is delayed

2008-09-28 Thread Ken Irving
how i can modify the > output buffer to stdout. Try comparing terminal settings on each platform, e.g., with stty -a, and look into any differences. Ken -- Ken Irving, [EMAIL PROTECTED], 907-474-6152 Water and Environmental Research Center Institute of Northern Engineering University of Alaska, Fairbanks

Re: [PATCH] command-not-found-handle

2008-04-09 Thread Ken Irving
ord_list(w, (WORD_LIST*)NULL); > + > +w = make_word(pathname); > +cmdlist->next = make_word_list(w, (WORD_LIST*)NULL); > + > +fval = execute_shell_function (f, cmdlist); > +exit(fval); > } > >/* Execve expects th