no apostrophe allowed in comment

2013-07-30 Thread Curtis Doty
When the comment is inside of a substituted process. #! /bin/bash -ex # tee >( # this is nifty echo hi there ) The above works. Whereas the below fails. #! /bin/bash -ex # tee >( # ain't this nifty echo hi there ) It burps thusly: ./foo.sh: line 7: bad substit

test -nt not sane

2011-08-10 Thread Curtis Doty
Or maybe I'm not groking. When one compares against a b0rk symlink, the result of -nt (newer than) is true--when it isn't! mkdir directory ln -s noexist symlink touch -hr directory symlink test directory -nt symlink &&echo yes ||echo no They have identical mtimes (as set by touch)--i.e

Re: process substitution in PROMPT_COMMAND

2011-08-07 Thread Curtis Doty
On Sun, 7 Aug 2011, Chet Ramey wrote: On 8/7/11 6:00 PM, Curtis Doty wrote: local job jobcount=0 while read job do ((jobcount++)) done < <(jobs) As you suspect, the problem is with this part of the function. It doesn't really have anything to do with PROMPT_COMMAND, t

process substitution in PROMPT_COMMAND

2011-08-07 Thread Curtis Doty
I've recently refactored my PROMPT_COMMAND function to avoid superfluous fork()s. In the body of the function, what was once this line: local jobcount=$(jobs |wc -l) is now this: local job jobcount=0 while read job do ((jobcount++)) done < <(jobs) This works fine on bash 4. However,

Re: read into array Segfaults

2011-06-21 Thread Curtis Doty
On Tue, 21 Jun 2011, Chet Ramey wrote: declare -A foo read -a foo << Yes. It certainly shouldn't crash the shell. Try the attached patch and let me know that it works for you. Thanks for the report. Yep, thanks. Verified no segfault; only the error. Tested on 4.0, 4.1, and 4.2 in F

read into array Segfaults

2011-06-20 Thread Curtis Doty
I did a stupid thing. Tried to read into an array--which is indexed--but the variable is already an associative array. declare -A foo read -a foo <

Re: exit status question

2010-12-20 Thread Curtis Doty
11:30am Eric Blake said: On 12/20/2010 11:25 AM, Curtis Doty wrote: Not exactly sure if this is a bug. But I don't understand why only the first time running ((i++)) returns an error exit status. Because it follows the same semantics as 'expr', where status 1 is reserved for a

exit status question

2010-12-20 Thread Curtis Doty
Not exactly sure if this is a bug. But I don't understand why only the first time running ((i++)) returns an error exit status. Here's my script: #! /bin/bash echo $BASH_VERSION ${BASH_VERSINFO[5]} set -x #set -e i=0 ((i++)) echo $? ((i++)) echo $? And here's what the output looks like: 4.1.7

Re: FWD: About Bash Script

2010-02-16 Thread Curtis
I actually re-wrote it and got it working. Thanks for the suggested reading Mart, i'll definitely look those over. Thanks for all the help!

Re: FWD: About Bash Script

2010-02-16 Thread Curtis
Thanks pk! That's the same thin Greg told me. #!/bin/bash if [! -e b.txt]; then mv a.txt b.txt exit fi #The previous commands checks to see if b.txt is NOT already there, if NOT, it renames a.txt to b.txt #If the script gets here, b.txt EXISTS.. # does_exist is a recursive fu

Re: FWD: About Bash Script

2010-02-16 Thread Curtis
Thanks Greg for the resource material! I'm making changes now

Re: FWD: About Bash Script

2010-02-16 Thread Curtis
Here's what I have but i'm getting some errors #!/bin/bash if ! (-e b.txt); then mv a.txt b.txt exit fi #The previous commands checks to see if b.txt is NOT already there, if NOT, it renames a.txt to b.txt #If the script gets here, b.txt EXISTS.. # does_exist is a recursive

Re: FWD: About Bash Script

2010-02-15 Thread Curtis
On Feb 15, 3:20 pm, Mart Frauenlob wrote: > > Original Message > > Subject:   About Bash Script > > Date:      Mon, 15 Feb 2010 10:39:25 -0600 > > From:      Curt > > To:        mart.frauen...@chello.at > > Hi Mart- > > > I saw you were helping another guy with a bash script