Re: bash 2.05b.0(1)-release on Debian Sarge: [A-Z]* expands as [A-Za-z]* :-(

2008-01-30 Thread Bob Proulx
Alan Mackenzie wrote: Ah. I've got $LANG set to en_GB. Who did this? How dare they! OK, I did this myself, somehow, presumably during installation of Debian Sarge. On Debian: sudo dpkg-reconfigure locales Why didn't they tell me I was messing up my shell? Why do I feel so stupid?

Re: -e does not work with subscript

2008-01-29 Thread Bob Proulx
Stepan Koltsov wrote: set -e ( cd some-dir make ) ... Most readers (and writers) expect script to fail if make failed. So I think that outer bash should exit with error on (false) :-) Of course, script can be rewritten as ( cd some-dir make ) || false Of course the script can also be

Re: bash 2.05b.0(1)-release on Debian Sarge: [A-Z]* expands as [A-Za-z]* :-(

2008-01-28 Thread Bob Proulx
Eric Blake wrote: According Alan Mackenzie: | % ls [A-Z]* | . Sadly, ls ignores my intentions and undiscerningly prints a list of | all files whose names begin with a letter, big or small. Actually, it follows your (unintended) directions, thanks to your current locale, which does a

Re: Taking input line by line from a config file in Bash

2008-01-02 Thread Bob Proulx
Matthew_S wrote: With the 'while read line', it appears that I don't need to keep track of the line numbers. In fact this below does exactly what I need it to do; Good. cat $File | # Supply input from a file Search the web for useless use of cat. Your use of it here is useless. But it

Re: arithmetic evaluation (may be error) ?

2007-12-29 Thread Bob Proulx
Roman Rumisek wrote: $ echo $((096 4)) bash: 096 4: syntax error: operand expected (error token is 096 4) $ echo $((0096 4)) bash: 0096: value too great for base (error token is 0096) In both of those the 9 is not a valid octal component. You are running into octal conversion problems.

Re: Variable passed to system contains garbage characters

2007-12-17 Thread Bob Proulx
Patrick Nagelschmidt wrote: The script below fails on my box with the following output: 1197676800 date: invalid date `1970-01-01 \033[?1034h1197676800 sec' So for some reason the value passed to date got a nasty prefix. I cannot recreate the problem.

Re: Recursive directory traversal?

2007-12-17 Thread Bob Proulx
James McMurray wrote: How can I recursively move through a directory tree and call a function in each folder? Mike Stroyan recently posted an example doing exactly this: http://lists.gnu.org/archive/html/bug-bash/2007-11/msg00080.html Bob

Re: unset strangely rejects certain function names eg fu~

2007-12-12 Thread Bob Proulx
unset strangely rejects certain function names eg fu~ $ function fun(){ echo running fun;} $ function fu~(){ echo running fu~;} $ fun running fun $ fu~ running fu~ $ unset fun $ unset fu~ bash:

Re: Please advise on bash programming tactics/strategy

2007-12-11 Thread Bob Proulx
cga2000 wrote: I was wondering if there is any way I can convince netstat to return its output to bash variables for additional processing. Do you mean like this? rxcnt=$(netstat -ni | awk '/^eth0/{print$4}') Pretty simple logic: Do forever: Call netstat to obtain RX TX byte

Re: Meta question w/rt list

2007-12-10 Thread Bob Proulx
Linda Walsh wrote: Would it be a bad thing to set mail-list software to automatically default to the list as the 'default' response, and the user would have to address an email, manually, to not respond to the list? If there were a good mail header to use then it would be a good thing. But

Re: Disowned process hangs terminal during logout/exit

2007-12-05 Thread Bob Proulx
Jesse Molina wrote: Netcat has strange issues about wanting stdin -- it won't run backgrounded without being fed tail -f /dev/null. I wonder if it isn't the problem here. I had discounted it since I redirected both stdin and stdout to the logfile. I have had problems with netcat before. As

Re: exit doesn't work from inside of PIPED read block

2007-11-19 Thread Bob Proulx
Blaine Simpson wrote: exit doesn't exit the current shell when inside of PIPED read blocks, yet everything works find if the input comes from redirection. This is because pipes operate in subshells and the exit applies to the subshell. Please see the bash FAQ question E4 for more

Re: read doesn't work with piped stdin

2007-11-19 Thread Bob Proulx
Blaine Simpson wrote: read silently fails when stdin is piped to it. -u switch does not help. Redirection works fine. Same as the other problem with exit in a pipeline. Pipelines operate in subshells. Environment variables are local to the process. Please see question E4 in the bash

Re: find help about 'read' built-in command

2007-11-15 Thread Bob Proulx
Andreas Schwab wrote: Bob Proulx writes: Since $PWD is a bash specific feature It isn't. would still tend to use $(pwd) because that works both in bash and in POSIX shells (would be okay with #!/bin/sh). $PWD works in every POSIX shell. Oh! I had it in my head

Re: find help about 'read' built-in command

2007-11-14 Thread Bob Proulx
Mike Stroyan wrote: 龙海涛 wrote: Bob Proulx wrote: test=$(pwd) echo $test By the way, the variable $PWD has the same current directory value as $(pwd) . Yes, you have a point, but... Even though this is a bash list I still prefer to use standard constructs when possible

Re: find help about 'read' built-in command

2007-11-13 Thread Bob Proulx
龙海涛 wrote: i want to store the current working dir to a variable, i write The most common way to save the present working directory to a variable would be to use the $(...) form. test=$(pwd) echo $test Try that. Bob

Re: Bash 2.05a isn't calling gawk as expected

2007-11-07 Thread Bob Proulx
[EMAIL PROTECTED] wrote: A shell script which worked perfectly using 1.14.7(1) fails to execute properly using 2.05a.0(1)-release. The purpose of the script is to parse a session log file found in each user's home directory, and determine whether a record belonging to some other user

Re: Home key doesn't work on properly on prompts with ANSI escapes

2007-10-29 Thread Bob Proulx
Christian Schubert wrote: PS1='\e[32m$\e[m' Non-printing characters need to be bracked with \[...\] to inform bash that they do not display. Please see the bash documentation in the section on PROMPTING. \[ begin a sequence of non-printing characters, which could

Re: Escaping of exclamation marks inside quotes seems wrong

2007-10-18 Thread Bob Proulx
[EMAIL PROTECTED] wrote: When trying to produce an exclamation mark (!) inside a quoted string is behaving differently from expected. I cannot see a way of producing an exclamation mark inside a doubly-quoted () string in the bash prompt. You are correct. However that

Re: bash -n doesn't seem to catch all syntax errors...

2007-10-15 Thread Bob Proulx
Ken Failbus wrote: When I specify on command-line bash -n myscript name. Bash doesn't check for valid syntax errors. E.g. if variable is missing a $ infront of it while assigning a value. This is not catched by bash. Unfortunately what you are describing is not a syntax error. It is perfectly

Re: bash script in background gets interrupted if carriage return is hit...

2007-10-12 Thread Bob Proulx
Ken Failbus wrote: I have a script that when run in background and while it's running hitting a carriage return causes it's to completely stop the script and the terminal in which it's running disappears. It seems as though it received a interrupt signal. Is there some kind of a job control or

Re: ulimit builtin block size

2007-10-12 Thread Bob Proulx
Chet Ramey wrote: I've received a bug report noting that the `block size' the ulimit builtin is using (the multiplier applied to the -f and -c options) is 1024, where the POSIX standard and historical sh usage specify 512. I'm considering changing the default block size for the next version.

Re: Bugs?!

2007-10-10 Thread Bob Proulx
Felipe Nascimento wrote: Subject: Bugs?! Please give a meaningful error message when reporting a bug. If everyone reported every bug with bug then there would really only be one bug in the entire world. We fixed Bugs already. Say something meaningful such as bash foo does bar instead of zap

Re: What does the ` Characteter Do?

2007-10-08 Thread Bob Proulx
duff wrote: What does this ` character do in the command line? Command Substitution. And I was a little surprised to see that when I looked for that character in the man page that it did not appear anywhere within it in the Debian formatting of the manual. It appears that there is a formatting

Re: ssh inside a loop problem

2007-10-05 Thread Bob Proulx
caudio wrote: Hi everybody! I have recently had a problem trying to make an ssh runn inside a loop. Your question is really not about a bug in bash. It would be more appropriate for a general shell script discussion list. It is somewhat off-topic here. Having said that, I can't resist

Re: IS there a label in ksh / bash for re-startability? Can you add this functionality?

2007-10-04 Thread Bob Proulx
Rajeswar N wrote: IF for some reason task n fails, I am not able to re-start the script from the nth step. The shell is a programming language. It will do exactly what you program it to do. It will do nothing more and nothing less. IS there a lable available in ksh? There are no labels

Re: Function visibility

2007-10-02 Thread Bob Proulx
Stephane Chazelas wrote: However note that the file pointed to by the BASH_ENV environment variable is sourced even by non-interactive shells And while that feature can be useful it can also break working scripts. Therefore I try to ignore that this feature exists and hope that no one (ab)uses

Re: Multi-word matching in history expansion

2007-10-01 Thread Bob Proulx
The Wanderer wrote: Quite some time and several varyingly-significant updates of bash ago, I was able to perform history expansion on multi-word commands. At present and for some while now, it instead expands to ls /tmp/ /h This is also what csh does in this situation too. This type of

Re: variable and special chars problem

2007-09-26 Thread Bob Proulx
_Biff wrote: I am having an issue figuring out how to input a value that has special chars and using that var as follows: input value(no quotes): name:phone Script: location='${USERINFO}' The quotes are part of the actual script? That does not make sense in that particular context.

Re: Bash Commander: new project

2007-09-20 Thread Bob Proulx
Serge Vakulenko wrote: What do you think about extending bash functionality with visual two-panel file browser? Here is a new project to implement this: http://bashc.wiki.sourceforge.net/ Critique and suggestions are welcome. I think it looks very much like midnight commander and other file

Re: Process Substitution backgrounds the command list?

2007-09-15 Thread Bob Proulx
Chet Ramey wrote: No, there's no way to wait for it. Hmm... That does make it very difficult to actually use correctly. If there are any practical uses I am missing seeing them. Any useful examples? Is that enough of a misfeature to qualify as a bug? Bob

Re: -d option not working. . .?

2007-09-12 Thread Bob Proulx
Michael Williams wrote: if [-d $i] That is not the correct syntax. The [ is a shell builtin, not a shell metacharacter. Shell metacharacters do not need to be separated by whitespace but the test program needs to be apart or it won't be parsed right. That is why you are seeing [-d not

Re: bash scripting help

2007-09-12 Thread Bob Proulx
chitti wrote: I need to seperate the UDP and TCP ports from the /etc/services files. any pointers or help on scripting this in bash would be helpful Open ended questions such as that are not the greatest way to get going. It is better if you read one of the many tutorials and howtos that are

Process Substitution backgrounds the command list?

2007-09-08 Thread Bob Proulx
I am confused by the order of operations of this following: $ { echo hello world | tee (md5sum 12) ;} ; echo goodbye hello world goodbye $ 6f5902ac237024bdd0c176cb93063dc4 - Shouldn't bash wait for the subprocess finish before the next command is invoked? I did not expect the (list) to

Re: script using file dates

2007-09-06 Thread Bob Proulx
marquis wrote: I'm looking for an exisiting script, or a command to help w/ processing files by date. I have a test website and need to upload only the files that have been changed since the last upload. I'm thinking of creating a file list and the date of the last upload. if the

Re: I can't get bash-3.2.17 to process startup/login scripts to save me, please help!

2007-08-16 Thread Bob Proulx
SciFi wrote: Bob Proulx wrote: $ strings bash | grep profile noprofile /etc/profile ~/.profile ~/.bash_profile That looks good at least. $ sudo chmod 0644 /etc/profile I *know* that! What I was striving for was to get at all the problems to be sure it is executable if need

Re: script using file dates

2007-08-15 Thread Bob Proulx
warnockm wrote: I'm looking for an exisiting script, or a command to help w/ processing files by date. I have a test website and need to upload only the files that have been changed since the last upload. This sounds like the perfect application for use of rsync. I'm thinking of creating a

Re: double click filenames with spaces

2007-08-15 Thread Bob Proulx
maryatthelake wrote: I am using voice recognition software (Dragon Naturally Speaking) with the bash shell. I have a command that double clicks on a filename then copies it and does a cd to it on the command line. Of course, the command doesn't work when there is a space in the filename

Re: I can't get bash-3.2.17 to process startup/login scripts to save me, please help!

2007-08-11 Thread Bob Proulx
SciFi wrote: Bob Proulx wrote: Is this a self-compiled binary? Yes, I do not use pkg-mgrs such as fink or macports, maybe only for clues when a regular build bombs (straight from the tarballs). If you have self compiled it then it should be possible to debug it. What is the value

Re: PATH strange behaviour

2007-08-03 Thread Bob Proulx
Paul Jarc wrote: Jérémy Hervé wrote: -bash: /usr/sbin/httpd: No such file or directory hash -r will fix that. See help hash and man bash for details. There is also checkhash. shopt -s checkhash In man bash: checkhash If set, bash checks that a command found in the

Re: escaping exclamation in double quoted string

2007-07-28 Thread Bob Proulx
Please keep replies to the mailing list so that others can participate in the discussion and any answers will be archived. Thanks. John Tromp wrote: That is perfectly clear! However, the question remains: what is the rationale of that specification? I was not part of the decision and can

Re: escaping exclamation in double quoted string

2007-07-27 Thread Bob Proulx
John Tromp wrote: echo hi\! still shows the backslash Thank you for your report. However this is intended behavior. And it is also documented! :-) man bash Enclosing characters in double quotes preserves the literal value of all characters within the quotes, with the exception

Re: deleting coma in a large number of files

2007-07-21 Thread Bob Proulx
Timothee wrote: as said in the title, I have suppress all comas in a lot of text files located in the same directory, all having the same name but with a different number at the end (year1, year2, year3, ...). I'm sure this can be done very rapidly in bash but have no idea of how to write

Re: Arithmetic expressions and parameters with newlines breaks

2007-07-02 Thread Bob Proulx
Jan Schampera wrote: Parameters inside arithmetic contexts like $(()) and (()) break the expression parsing when they contain a newline Thank you for your bug report. $ foo=12 34 $ echo $((foo)) bash: 12 34: syntax error in

Re: bash: no job control in this shell

2007-07-02 Thread Bob Proulx
[EMAIL PROTECTED] wrote: Hi Bob, a quick question if I could as I am trying to determine if my bash thinks it has a tty device or not and therefore is interactive or not. Internally bash will use the libc isatty(3) routine to determine if the input/output files are tty devices. In the shell

Re: Arithmetic expressions and parameters with newlines breaks

2007-07-02 Thread Bob Proulx
Jan Schampera wrote: Well, I guess intuitively expected that it evaluates to 0, like for example: $ test=string $ echo $((test)) 0 In that case it is like the 'atoi(3)' routine. A non-numeric has no number value and is evaluated to be zero. A single zero is a valid arithmetic expression.

Re: Evaluate expression every time directory changes

2007-06-29 Thread Bob Proulx
bash_user wrote: That is correct. I would like to understand what triggers the shell to re-evaluate PROMPT_COMMAND every time directory / clock change occur. The documentation for bash says: PROMPT_COMMAND If set, the value is executed as a command prior to issuing

Re: bash: no job control in this shell

2007-06-28 Thread Bob Proulx
Matthew Woehlke wrote: Bob Proulx wrote: You would probably need q\n in order to get the data flushed to the subprocess. This is probably a stdio buffering issue. When the stdio library determines that the output is not a tty then the output is buffered into large blocks for performance

Re: wrong logical evaluation of expressions involving true or false commands

2007-06-25 Thread Bob Proulx
Miguel Ángel wrote: Evaluating expressions like: [ true -a false ] ; echo $? always returns 0 (true), doesn't mind if I change true for false or viceversa. In the case of the test operator (aka '[ expr ]') use of true and false as you have done are strings and not boolean expressions and not

Re: Timing an operation

2007-05-25 Thread Bob Proulx
Matthew_S wrote: interval$i=$(($date2 - $date1)) #1st 2nd errors ... I'm getting the errors; ./file.sh: line x: intervala=1: command not found ./file.sh: line x: intervalb=1: command not found ./file.sh: line x: - : syntax error: operand expected (error token is )

Re: Infinite loop and crash Linux via BASH command

2007-05-17 Thread Bob Proulx
[EMAIL PROTECTED] wrote: In this site http://www.istf.com.br/vb/showthread.php?t=11153 (pt_BR) there is a command and an explanation of as this simple command : (){ :|: };: can crash the Linux completely. It would be interesting you will correct this. You are reporting what is well

Re: bash=~ bug or feature

2007-05-17 Thread Bob Proulx
Jeff Chua wrote: With bash 3.1.17(4)-release # [[ abcd =~ ^a ]]; echo $? 0 With bash 3.2.17(3)-release # [[ abcd =~ ^a ]]; echo $? # is this a bug??? 1 # [[ abcd =~ ^a ]]; echo $? 0 Is this a bug? The behavior has been intentionally changed. Please see Bash FAQ item E14. Bob

Re: HISTCONTROL=erasedups

2007-05-09 Thread Bob Proulx
Chet Ramey wrote: If you want to force the history file to be completely rewritten, you can use `history -w' at shell exit to rewrite it. There is, unfortunately, currently no easy way to force the `rewrite-at-exit' behavior. Could a shell trap be used to do this? trap 'history -w' EXIT I

Re: How to remove a specific line in a file

2007-05-01 Thread Bob Proulx
Matthew Woehlke wrote: $ sed -e '5d' -e '/FOO/d' -e '5,7d' myfile mynewfile Note that redirecting output to an input file is not recommended (you might end up truncating the file, for example). You almost certainly would. If you need to replace the file, it is best to write to a

Re: Bash arithmetic doesn't give error message on wrap.

2007-04-29 Thread Bob Proulx
Richard Neill wrote: b)Consistent with other cases, where bash does give warnings. For example: $ X=$((3+078)) bash: 3+078: value too great for base (error token is 078) $ echo $? 1 That is not really a comparable case. The problem there is that the leading zero specifies an octal

Re: filename expansion with [a-z] matches upper case

2007-04-01 Thread Bob Proulx
[EMAIL PROTECTED] wrote: The expansion of the filename pattern *.[a-z]* matches files with upper case after the period, not just lower case, even though the nocaseglob is set to off, when the LANG variable is set to en_US.UTF-8. Yes. What you are seeing is not a bug

Re: shouldn't prompt printing be smarter?

2007-04-01 Thread Bob Proulx
Francesco Montorsi wrote: I think you all have encountered this: do a cat somefile where somefile is a text file _without_ a final newline. You'll see the prompt is printed both at the end of the text printed by 'cat' and then, also at the beginning of that same line. I cannot reproduce

Re: bash is executing command at the prompt when closing

2007-03-21 Thread Bob Proulx
[EMAIL PROTECTED] wrote: Please see mandriva bugreport for a more detailed explanation with examples at: http://qa.mandriva.com/show_bug.cgi?id=21708 The problem is that bash always executes the command at the prompt when closing the terminal window. You may be

Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd

2007-03-01 Thread Bob Proulx
Matthew Woehlke wrote: Apparently selectively shadowing libc is non-trivial... any suggestions/hints? Not so much non-trivial as perhaps non-obvious. The dynamic loader is part of libc and so by the time the program tries to use LD_LIBRARY_PATH it is already too late because it has already

Re: Bash getopts option

2007-03-01 Thread Bob Proulx
/Command_002dLine-Interfaces.html#Command_002dLine-Interfaces Here is a simple but complete example. This produces output suitable to generate the man page with help2man. Enjoy, Bob #!/bin/sh # # A sample program illustrating shell option parsing. # # Copyright (C) 2007 by Bob Proulx [EMAIL PROTECTED

Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd

2007-02-27 Thread Bob Proulx
Matthew Woehlke wrote: Бојан Ландекић wrote: Is it possible to put bash on some portable media and use it on a system that is bash-less without worrying about dependencies? Not unless you build it statically, it isn't. :-) Although I think if you build bash it gives you all the libraries

Re: nocaseglob

2007-01-28 Thread Bob Proulx
Aharon Robbins wrote: Chet Ramey wrote: You need to force the issue. Add export LC_COLLATE=C to your startup files. I prefer to use an even bigger hammer: export LC_ALL=C That is a big hammer! But today I prefer to use UTF-8 character sets and the associated machinery. It is

Re: nocaseglob

2007-01-20 Thread Bob Proulx
Bruce Korb wrote: This cannot have been overseen, so perhaps I am not understanding how nocaseglob is supposed to work: I think you have the nocaseglob right. I think this is a variable set but not exported problem. Just guessing though. $ bash --version GNU bash, version 3.1.17(1)-release

Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd

2007-01-04 Thread Bob Proulx
Matthew Woehlke wrote: Bob Proulx wrote: Traditional Unix machines used a csh script /usr/bin/which to search a defined set of system paths. Newer ksh used 'whence'. Bash uses 'type'. XSI extensions to POSIX require 'command -v'. Debian implemented 'which' as a bash shell script

Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd

2007-01-04 Thread Bob Proulx
Bojan Land wrote: Bob Proulx wrote: This is possible when it has been cached by bash and then the executable is either moved from its original location or a new executable appears earlier in PATH. I did not move the executable. Right. or a new executable appears earlier in PATH. I

Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd

2007-01-03 Thread Bob Proulx
I have learned a lot from your reply, and yes some of what you wrote explains this as not being a bug; after a reboot I cannot reproduce these results. You should not need to reboot to clear a single shell process hash cache. Simply starting a fresh shell, such as opening a new window, would

Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd

2007-01-02 Thread Bob Proulx
Bojan Land wrote: Is what I am describing a bug, or lack of understanding? I am not sure. I read through your posting very carefully but was not quite sure what you were asking. Could we on the mailing list have more information? There are three examples here. If executable file is in cwd

Re: Feature request for the 'local' builtin command - passthrough return status

2006-12-29 Thread Bob Proulx
Daniel Webb wrote: First off, please CC me on any replies because there are no instructions on the FSF bash page (http://directory.fsf.org/bash.html) to tell me how to subscribe to this list. All of the mailing lists accept subscription commands by mail to the -request address. The following

Re: Calling external programs in bash script

2006-12-29 Thread Bob Proulx
Ramprasad B wrote: I need a help in calling external programs from shell script. A shell script and specifically a bash script automically calls external programs. For example a java class or methods and c functions from a shell script. Those programs need to be turned into a standalone

Re: Hidden files feature request

2006-11-25 Thread Bob Proulx
Uno Engborg wrote: In Gnome, MacOS-X, and in Kubuntu KDE, you can make a file hidden from the desktop environment by listing it in a file called .hidden. The .hidden file resides in the same directory as the files to be hidden, and lists the files to be hidden as one file/line. Files hidden

Re: problem with conditional syntax

2006-11-14 Thread Bob Proulx
mrkiwi wrote: I am trying to write the code for this psudo code; function askYN{ echo continue? read the response into $response } Can you show your actual askYN function? You also need to screen all user input for validity. This is what i have so far, but it complains (i think)

Re: Spaces in args, escapes, and command substitution

2006-10-29 Thread Bob Proulx
Bob Proulx wrote: This is probably not a an optimal solution because this is late night time for me but this works: eval vi $(grep -l PATTERN * | sed 's/ /\\ /') This also works. find . -exec grep -q PATTERN {} \; -exec vi {} \; Bob ___ Bug

Re: Spaces in args, escapes, and command substitution

2006-10-29 Thread Bob Proulx
[EMAIL PROTECTED] wrote: But, given that find is clever enough to assemble arguments containing spaces into an arglist and feeding them to vi, why can't bash? I find the 'find' solution to be one that I am more attracted to but if you put it that way I will note that bash has the capabilities.

Re: Spaces in args, escapes, and command substitution

2006-10-29 Thread Bob Proulx
[EMAIL PROTECTED] wrote: This is probably not a an optimal solution because this is late night time for me but this works: eval vi $(grep -l PATTERN * | sed 's/ /\\ /') Yes, that works. But surely such a grotesque syntax is not really in the spirit of concise unix expressions.

Re: How to detect bash?

2006-10-10 Thread Bob Proulx
mwoehlke wrote: Anyone have any clever, VERY reliable tricks for detecting if the current shell is bash? The obvious way is '[ -n $BASH ]', but in the I would probably avoid the clever and go with the simple to understand and unlikely to be accidentally invoked method. test

Re: Need to delete files that have a timestamp on its name

2006-10-09 Thread Bob Proulx
ozwolverine wrote: I hava a cron that generates a backup with a name like: backup_jboss-4.0.3_09102006.tar.gz, it gets generated once a week, every friday, I need that after the cron creates the new weekly backup to delete the others and I want just to leave in the system the last one, how

Re: How to suppress Terminated... message after kill

2006-09-25 Thread Bob Proulx
Chet Ramey wrote: Com MN PG P E B Consultant 3 wrote: monitest.sh: line 9: 3486 Terminatedtail -f foo bar (1) Monitor was not set ... Not really. If a pipeline in a shell script is killed by a signal other than SIGINT or SIGPIPE, the shell reports it. People generally want to know

Re: Bash2 segfaults in while: do loops

2006-09-15 Thread Bob Proulx
[EMAIL PROTECTED] wrote: Bash Version: 2.05b Patch Level: 0 ... When trying to run a while loop, bash seldom segfaults. The behavior is not constant. The machine is in fact an AMD 64x2, here is a extract from dmesg: ... [EMAIL PROTECTED] ~]$ while : ; do true ;done Segmentation

Re: Job queing

2006-08-21 Thread Bob Proulx
Mårten Segerkvist wrote: command1 %1 command2 %2 command3 (where the second command line awaits the execution of the first etc.) In a script you can grab the process id of the last background job with $!. Then you can wait for that job id. command wait $! command2 wait $!

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

2006-07-31 Thread Bob Proulx
Poor Yorick wrote: The following line does not perform the echo command. : ${FAKEVAR?} || echo hello This seems inconsistent, since the return status is set to one, not to mention that the null command is documented to return a zero exit code. It would be a convenient and concise syntax

Re: bash 3.1 on Solaris 9

2006-07-18 Thread Bob Proulx
856-256-4979 = -Original Message- From: Bob Proulx [mailto:[EMAIL PROTECTED] Sent: Friday, July 14, 2006 1:32 AM To: Cheltenham, Christopher J Cc: bug-bash@gnu.org Subject: Re: bash 3.1 on Solaris 9

Re: PATH and $0

2006-07-13 Thread Bob Proulx
Stephane Chazelas wrote: $0 will always contain the file path, unless the script was started as: bash script.sh And there's no script.sh in the current directory (in which case sh/bash will have looked up script.sh in $PATH). Of course using command as you have done will work for bash.

Re: terminating lines with accidental eof

2006-07-04 Thread Bob Proulx
Martin Wheatley wrote: You also asked ... Is there an example of another command shell which handles this situation in a different and possibly better way? /bin/sh handles the situation correctly (in our opinion) On my system /bin/sh is a symlink to /bin/bash and behaves similarly.

Re: bash3 on FreeBSD weirdness

2006-06-29 Thread Bob Proulx
Miek Gieben wrote: http://www.miek.nl/projects/rdup/svn/trunk/sh-tools/mirror.sh.in Chet Ramey wrote: The root cause is probably that something is consuming all of the input from stdin (the pipe) on FreeBSD and not on Linux. I suspect the call to `head'. The two implementations

terminating lines with accidental eof (was: [50 character or so descriptive subject here (for reference)])

2006-06-29 Thread Bob Proulx
Martin Wheatley wrote: Description: Bash may inadvertently execute a command that the user did not anticipate if STDIN is closed. The shell reads data from the input. It then parses the input into commands and executes them. If this is not what you want then you must avoid closing the

Re: process redirection: syntax error after while loop

2006-06-24 Thread Bob Proulx
Chet Ramey wrote: Marvin Greenberg wrote: while read f; do echo $f; done ~/.bash_history But, this fails: while read f; do echo $f; done (cat ~/.bash_history) bash: syntax error near unexpected token `(cat ~/.bash_history) That's not a redirection; it's

Re: file test bug in bash 3.1

2006-05-22 Thread Bob Proulx
Zackary Deems wrote: echo blah /tmp/blah ln -s /tmp/blah /tmp/blah.link if [[ -f /tmp/blah.link ]] then echo /tmp/blah.link is a regular file else echo /tmp/blah.link is NOT a regular file fi Thank you for the very nice and concise test case. links now match for both links and

Re: How to use [[ string =~ regexp ]]?

2006-05-21 Thread Bob Proulx
Chet Ramey wrote: Peter Volkov wrote: Please CC my email to answers as I'm not subscribed to the list. $ [[ string =~ [a-z] ]] echo something something ... The real question is whether or not quoting the pattern should work as it does with other [[ pattern matching operators, which is

Re: How to use [[ string =~ regexp ]]?

2006-05-21 Thread Bob Proulx
Chet Ramey wrote: It seems reasonable that quoting any part of the rhs to the =~ operator should cause it to behave in the same manner. Since the arguments to [[ don't undergo any of the expansions that require quoting to protect them, there's no reason for =~ to act differently than the

Re: Help!

2006-05-01 Thread Bob Proulx
Miguel Luis wrote: - I'm Using Ubuntu Dapper Drake. I don't believe that Ubuntu has released Dapper Drake yet. Therefore what you have must be a release candidate for Dapper Drake. [EMAIL PROTECTED]:~/Desktop$ - I just ran my cesar's program like this: [EMAIL PROTECTED]:~/Desktop$ echo

Re: Bug Bash

2006-04-25 Thread Bob Proulx
OULBOUB Lhassan Ext OF/UNPS wrote: I have an server with GNU/Linux 2.4.21-20.0.1 with package bash bash-2.05b-29.0.3 When i worked with bash i have a 100% CPU Could you tell me why ? You presented very little information to work with. It will not be possible to suggest much. Try 'top' to

Re: test -f with no args is true

2006-04-15 Thread Bob Proulx
Charlie Bennett wrote: Is this expected behavior? [EMAIL PROTECTED] .ssh]# [ -f ] [EMAIL PROTECTED] .ssh]# echo $? 0 Yes. That is expected behavior. With one argument the return code is true if the string is non-zero in length. The case covered is this case: if [ $variable ]; then

Re: test -f with no args is true

2006-04-15 Thread Bob Proulx
Charlie Bennett wrote: H. I sat on that blasted committee. :-) I'll file a corrigendum or whatever it's called. This should at least be called out in the rationale. No biggie. I'll just make sure I quote all of my args. Yes, because test and [ were external commands when the API

Re: test -f with no args is true

2006-04-15 Thread Bob Proulx
Chet Ramey wrote: Bob Proulx wrote: As an alternative, you could use the [[ ... ]] syntax. That is the newer syntax, covered in POSIX too so should be portable to POSIX systems, but is always a built-in to the shell. POSIX declined to standardize [[...]]. It just happens to appear

Re: LINES and COLUMNS variables are not exported

2006-03-07 Thread Bob Proulx
Thierry EXCOFFIER wrote: LINES and COLUMNS variables are not exported, so applications using these variables can not find the screen size. The LINES and COLUMNS variables are an *override* to applications. It is not an application's primary method of getting the size

Re: Output redirection?

2006-01-29 Thread Bob Proulx
Yuri Karlsbrun wrote: I, probably, need bash-help mailing list, but I could not find it. Here is the bash script fragment: LOG_FILE=./logfile ... $LOG_FILE I supposed that the statement above redirects stdout to the logfile. But the following 'echo' statement prints on the screen. The

Re: incorrect brace expansion

2006-01-29 Thread Bob Proulx
Mike Frysinger wrote: bash -c 'echo a-{b}-c' a-{b}-c seems to me current behavior is inconsistent Yes. That is inconsistent with csh. csh -c 'echo a-{b}-c' a-b-c It is related to brace expansion but seems like a different case than the original poster's bug report. In the original

Re: a kill -TERM causes the EXIT trap to be executed

2006-01-26 Thread Bob Proulx
Vincent Lefevre wrote: An EXIT trap is executed when the process is killed, e.g. by the SIGTERM signal, which breaks traditional sh compatibility A lot of POSIX required behavior breaks traditional Bourne sh compatibility. and, IMHO, is not POSIX-compliant (see the explanations in the

Re: exit somtimes not exit's the script

2006-01-24 Thread Bob Proulx
Paul Jarc wrote: [EMAIL PROTECTED] wrote: a exit inside a loop inside a pipe exits's the loop and not the script. may bee a error. This is normal. Each element of a pipeline is run in a child process. Yes. Another more clear way of seeing this in the example would be something

Re: Alias and if

2005-12-04 Thread Bob Proulx
XIAO Gang wrote: #! /bin/bash if true; then alias myls=ls alias -p myls fi myls In a script it is considered better form to use shell functions than to use aliases. Aliases are an old csh feature. Functions generally provide that functionality in a better fashion. #!/bin/bash if

<    1   2   3   4   5   >