Re: Incorrect alias substitution

2009-02-24 Thread Paul Jarc
Vincent Lefevre vinc...@vinc17.org wrote: I get the following errors with bash 3.2.39 under Debian/unstable: bash -c 'alias a=echo OK 2 a /dev/null a' bash: line 1: a: command not found bash: line 2: a: command not found aliases aren't expanded by a non-interactive bash by default. If

Re: No tilde expansion right after a quotation

2009-02-15 Thread Paul Jarc
Jon Seymour jon.seym...@gmail.com wrote: If the builtin echo fails it will be because the bash interpreter has suffered a catastrophic failure of some kind [ e.g. run out of memory ]. Once that has happened, all bets are off anyway. Probably true, but command substitution forks a separate

Re: No tilde expansion right after a quotation

2009-02-15 Thread Paul Jarc
Jon Seymour jon.seym...@gmail.com wrote: On Mon, Feb 16, 2009 at 10:22 AM, Paul Jarc p...@po.cwru.edu wrote: CPATH=${CPATH:+$CPATH:}${#+~usr1/blah/blah} Out of interest, how does one derive that outcome from the documented behaviour of bash? That is, which expansion rules are being invoked

Re: No tilde expansion right after a quotation

2009-02-15 Thread Paul Jarc
Angel Tsankov fn42...@fmi.uni-sofia.bg wrote: How do you know that $# is always set? And what about $...@? To what values are these parameters set outside any function? $# gives the number of positional parameters. If there aren't any positional parameters, then it's set to 0. In the man

Re: No tilde expansion right after a quotation

2009-02-15 Thread Paul Jarc
Jon Seymour jon.seym...@gmail.com wrote: The manual specifies a rule for ${parameter:+word}, but not ${parameter+word}. It's there, but easy to miss: In each of the cases below, word is subject to tilde expansion, parame- ter expansion, command substitution, and arithmetic

Re: Help: Bash script that show you the last file created?

2009-02-15 Thread Paul Jarc
tal396 tal...@gmail.com wrote: Coz its could be find in alot of subdirs like /home/server/backups/local_backups/1-1-2009/server/mysql/1-1-2009.sql /home/server/backups/local_backups/1-2-2009/server/mysql/1-2-2009.sql /home/server/backups/local_backups/1-3-2009/server/mysql/1-3-2009.sql This

Re: Help: Bash script that show you the last file created?

2009-02-15 Thread Paul Jarc
Mike Frysinger vap...@gentoo.org wrote: the op wasnt asking for the time, they were asking for the last created file. and the ls man page talks how to sort by ctime. ctime is the time when the inode was last modified, not (necessarily) the time when the file was created. paul

Re: Option -n not working reliably and poorly documented

2009-02-11 Thread Paul Jarc
Ronny Standtke ronny.stand...@fhnw.ch wrote: The -n option not seem to work. Example with a little stupid nonsense script: --- ro...@ronny-desktop:/tmp$ cat test.sh #!/bin/sh if [ $blah == test] This sort of error can't be caught by -n, because it's part of a specific command, not

Re: Declaring variables as local effects command status $?

2009-02-06 Thread Paul Jarc
Michael Rendell mich...@cs.mun.ca wrote: local x=$( echo hi; exit 20); ret=$? Here you're getting the exit status of local itself, which is 0. If you want the exit status of the command substitution, make that a separate command: local x x=$( echo hi; exit 20); paul

Re: Migrating from tcsh to bash (issues)

2009-02-03 Thread Paul Jarc
Simos simos.li...@googlemail.com wrote: alias -- ../='cd ..' alias -- .../='cd ../..' alias -- /='cd /' You can do those as shell functions: ../() { cd ../; } .../() { cd ../..; } /() { cd /; } 2. An issue with PS1 is that there is no \w or \W version that can expand the ~. My aim is to get

Re: truncating the path in the bash prompt?

2009-01-14 Thread Paul Jarc
Matthew Woehlke mw_tr...@users.sourceforge.net wrote: Actually, a feature that would be REALLY helpful is a way to specify certain directory strings that should be abbreviated. PS1='...$(mypath)...' mypath() { case $PWD/ in /usr/local/src/kde/svn/trunk/*) printf %s

Re: ${parameter+word} not documented in bash.info or bash(1)

2009-01-08 Thread Paul Jarc
Martin Schwenke mar...@meltin.net wrote: Neither bash.info or bash(1) documents parameter expansion of the form: ${parameter+word} It's documented, but it's easy to miss. Just before the list of parameter expansion forms is this paragraph: In each of the cases below, word is

Re: Can't execute file from command line

2009-01-03 Thread Paul Jarc
men8th t...@avacta.com wrote: t...@ggeom:/usr/local/SunStudio12ml-linux-x86-200709-ii/sunstudio12/prod/bin$ ./CC bash: ./CC: No such file or directory However, the file clearly is there. Here is an extract of ls -l The problem could be that CC is a script, and the interpreter on its #! line

Re: command not found on remote server

2008-12-11 Thread Paul Jarc
Dolphin06 [EMAIL PROTECTED] wrote: Can i do something like this : ssh [EMAIL PROTECTED] export PATH=$PATH:/other path/ ; script param You'd have to quote the sequence of commands that should run on the remote host, so that the local bash and ssh see it as all one parameter: ssh [EMAIL

Re: command not found on remote server

2008-12-11 Thread Paul Jarc
Bob Proulx b...@proulx.com wrote: Also, using full paths is frowned upon. You mean invoking /directory/some-command directly instead of PATH=$PATH:/directory some-command ? It depends on the situation. If you think some-command is in /directory, but you want to allow for the possibility that

Re: [severe] access outside simlinked directory

2008-11-26 Thread Paul Jarc
AT-HE [EMAIL PROTECTED] wrote: if you have a simlink pointing to a directory, chdir to that symlink dir, and type something with '..', you access the parent of real directory, not previous simlinked one. That's the kernel's doing, not bash's. When interpreting pathnames

Re: Possible bug with respect to global variable within block of code when piping the output of later

2008-11-26 Thread Paul Jarc
Thiemo Kellner [EMAIL PROTECTED] wrote: Maybe the piping converts the block implicitly to a subshell. Yes, it does. This is documented in the man page, under Pipelines in the SHELL GRAMMAR section, and in the FAQ, entry E4. paul

Re: Regular experssions are not working in 3.2.39 as in 3.1.17

2008-10-14 Thread Paul Jarc
[EMAIL PROTECTED] wrote: regular expression are broken in 3.2.39 It's not broken; it's different. See entry E14 in the bash FAQ, and check out the compat31 option in shopt. paul

Re: errexit inconsistent behaviour with pipelines

2008-10-06 Thread Paul Jarc
Marcin Owsiany [EMAIL PROTECTED] wrote: On Mon, Oct 06, 2008 at 09:22:30AM -0400, Chet Ramey wrote: This bug only occurs when errexit is enabled and the final element of a pipeline is a simple command that returns a non-zero exit status. Well, if the final element in the pipeline is a simple

Re: Keep bash output to one line

2008-09-25 Thread Paul Jarc
mikehershey32 [EMAIL PROTECTED] wrote: Is there a way that i can make new output to the file overwrite the old file content without stopping the program and restarting the script or rotating the log file? { python -c ' import os import time while True: time.sleep(1) os.lseek(1, 0, 0) '

Re: test -t

2008-09-07 Thread Paul Jarc
Chet Ramey [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Is this a bug? $ t=test #bash builtin $ $t -t ' '; echo $? 0 Doesn't look like it: I think it is a bug, but libc may or may not hide it, depending on the strtol[l] implementation. SUS says: # If the subject sequence is empty

Re: test -t

2008-09-03 Thread Paul Jarc
[EMAIL PROTECTED] wrote: On (info (coreutils)File type tests, and test(1) man page, we see `-t FD' True if FD is a file descriptor that is associated with a terminal. Well please mention what happens if FD is omitted: bash's help test explains this, if you know where to look:

Re: Maximum limit of pipes in a single command ?

2008-08-29 Thread Paul Jarc
Keshetti Mahesh [EMAIL PROTECTED] wrote: I followed the syntax properly. But thats not the problem. Problem is how long can the concatenated string can be ? If it's too long to fit in that command line, you could pass it this way: sed -f (echo 's/old1/new1/;s/old2/new2/...') paul

Re: CDPATH reports to stdout and even non-interactively

2008-08-15 Thread Paul Jarc
Geoff Kuenning [EMAIL PROTECTED] wrote: BASH_ENVis the cracker's delight. Any setuid program that invokes a Bash script, even indirectly, is completely open to attack. Nope. Look at the -p option for set. BASH_ENV can be used to cause scripts to go

Re: function name bug ?

2008-07-30 Thread Paul Jarc
christophe malvasio [EMAIL PROTECTED] wrote: cbz (){ echo why 'cbz' not a valid function name ?;} bash: syntax error near unexpected token `(' It works for me. What does alias cbz say for you? paul

Re: inconsistent treatment of backslash-bang

2008-07-23 Thread Paul Jarc
Lawrence D'Oliveiro [EMAIL PROTECTED] wrote: Chet Ramey wrote: This is from the man page, in the QUOTING section: No idea about that. GNU project folks are well-known for deprecating man pages. I go by the reference manual http://www.gnu.org/software/bash/manual/bashref.html. That document

Re: bash: request for a way to return variables to the parent of a subshell

2008-07-22 Thread Paul Jarc
Richard Neill [EMAIL PROTECTED] wrote: the aim is to parse the output of ffmpeg -formats to see whether certain codecs are supported by that build. I'd use something like: while read line; do ... done (ffmpeg -formats 2/dev/null) That puts ffmpeg into a subshell instead of read. paul

Re: inconsistent treatment of backslash-bang

2008-07-20 Thread Paul Jarc
Lawrence D'Oliveiro [EMAIL PROTECTED] wrote: Chet Ramey wrote: I already explained that bash follows csh as closely as possible in its history expansion implementation. Well, it doesn't: Sure it does: in your examples, bash tries history expansion in exactly the same cases as tcsh. Where

Re: inconsistent treatment of backslash-bang

2008-07-20 Thread Paul Jarc
Lawrence D'Oliveiro [EMAIL PROTECTED] wrote: It's not going to break any executable scripts, since it has already been pointed out to me that history expansion doesn't happen in scripts. History expansion doesn't happen in scripts *by default*, but it can be enabled explicitly. paul

Re: inconsistent treatment of backslash-bang

2008-07-18 Thread Paul Jarc
Lawrence D'Oliveiro [EMAIL PROTECTED] wrote: pk wrote: This is documented in man bash, and only happens in interactive shells (not scripts). I just tried putting my six cases into a script, and I get exactly the same sort of output as interactively. How did you invoke the script? If you do

Re: alias expansion with functions in non-interactive mode

2008-05-31 Thread Paul Jarc
Marco [EMAIL PROTECTED] wrote: I couldn't find any information on it, but I'm noticing alias expansion is not happening in non-interactive mode within a function with expanded_aliases turned on. Is this a know problem, or am I missing something?

Re: spaces in the shebang interpreter path

2008-05-11 Thread Paul Jarc
Felix Schwarz [EMAIL PROTECTED] wrote: I'm not able to specify an interpreter in a shebang line if the path to this interpreter contains spaces. It's actually the kernel that interprets that line, not bash. The historical behavior is that space separates the interpreter from an

Re: function names which contain a 'dash' character

2008-05-09 Thread Paul Jarc
Jan Schampera [EMAIL PROTECTED] wrote: Stephane Chazelas wrote: Note that bash didn't have to. POSIX allows a shell to accept any character in a function name, but it says one shouldn't use those in a POSIX script, which is different. I'm not a POSIX expert, and this is the SUS, but I read:

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

2008-04-17 Thread Paul Jarc
luiscolorado [EMAIL PROTECTED] wrote: This is what I get when some file names have spaces: for i in `my-program` do echo $i done It echoes the following: sony apple hewlett packard Unquoted `` expansions are split into words using $IFS. So if you only want to split on newlines:

Re: Cursor misplaced while iterating history

2008-04-11 Thread Paul Jarc
João Abecasis [EMAIL PROTECTED] wrote: $ PS1='\e[0;[EMAIL PROTECTED] \W]$i\[\e[m\]' See entry E3 in the bash FAQ: http://tiswww.case.edu/php/chet/bash/FAQ paul

Re: Cursor misplaced while iterating history

2008-04-11 Thread Paul Jarc
João Abecasis [EMAIL PROTECTED] wrote: $ PS1='\e[0;[EMAIL PROTECTED] \W]$i\[\e[m\]' Sorry, ignore the previous message - you're missing \[ before the first escape sequence. paul

Re: shorthand attempt at 'basename file .ext'

2008-03-25 Thread Paul Jarc
Linda Walsh [EMAIL PROTECTED] wrote: echo ${{f##*/}%$ext} (but: -bash: ${{f##*/}%$ext}: bad substitution) Do I need to use an intermediate variable Yes. Unfortunately, the expansion operators work directly on variables - not on arbitrary strings which may contain other expansions. paul

Re: problems with 'read'ing from a pipe

2008-03-14 Thread Paul Jarc
John Smith [EMAIL PROTECTED] wrote: echo foo | read VAR echo $VAR See entry E4 in the bash FAQ: http://tiswww.case.edu/php/chet/bash/FAQ paul

Re: Which Bash

2008-02-24 Thread Paul Jarc
Charlse Darwin [EMAIL PROTECTED] wrote: i.e. How do I get the latest to be the login shell? You could add exec bash as the last command in ~/.bash_profile. paul

Re: broken pipe

2008-02-13 Thread Paul Jarc
Brian J. Murrell [EMAIL PROTECTED] wrote: It is a shame for this particular reason that head does not (perhaps as an option) consume it's input after displaying the 20 lines. You can do that with sed: ... | sed '21,$d' paul

Re: tricky shell script question

2008-02-12 Thread Paul Jarc
Erik-Jan Taal [EMAIL PROTECTED] wrote: Now watch the terminal where the script was still running. I would expect no output to be given, as I assumed the script is read into memory at startup and not during execution and this is what happens on most systems. On one server however, the 'bla' is

Re: matching !(patterns)

2008-01-29 Thread Paul Jarc
Linda Walsh [EMAIL PROTECTED] wrote: The longest matching substring (because you use / to start the pattern, yes?) No, !() normally uses the longest match, just like *, *(), and +(). s=thomas rich george Manpage says !() will match anything except one of the patterns. $s is 1

Re: capturing sub-expressions?

2008-01-29 Thread Paul Jarc
Linda Walsh [EMAIL PROTECTED] wrote: p=-e -p 60 -x --- That's why I wanted the capture -- to pick out the 60 -- where 60 represents a positive integer. The space between the -p and the number is optional. It sounds like you're looking for getopt. paul

Re: Exit application with two function calls

2008-01-27 Thread Paul Jarc
Linda Walsh [EMAIL PROTECTED] wrote: # *1 - using -e stops your script immediately on any error Not any error - only those from simple commands. The subtleties are subtle enough that I avoid -e, and use between all commands instead. paul

Re: unset strangely rejects certain function names eg fu~

2007-12-12 Thread Paul Jarc
[EMAIL PROTECTED] wrote: $ unset fu~ bash: unset: `fu~': not a valid identifier You can use unset -f to unset a function whose name doesn't fit the rules for variable names. paul

Re: Problem with pattern replacing when STRING is an expandable char

2007-12-12 Thread Paul Jarc
Heinz-Ado Arnolds [EMAIL PROTECTED] wrote: a=111.1 echo ${a//[0-9]/x} correctly gives xxx.x, but echo ${a//[0-9]/*} gives a listing of files in current directory. Seems that the * is expanded before replacing the pattern. No, it's expanded afterward, because the

Re: Disowned process hangs terminal during logout/exit

2007-12-05 Thread Paul Jarc
Jesse Molina [EMAIL PROTECTED] wrote: Basically, on the two troubled systems, my interactive shell will hang after I've disowned a process. On one other system, everything works as expected. I expect that a disowned process should not hang logout -- disowned means disowned. The terminal

Re: Problem with reading file and executing other stuffs?

2007-11-02 Thread Paul Jarc
Horinius [EMAIL PROTECTED] wrote: Paul Jarc wrote: Read entry E4 in the bash FAQ: http://tiswww.case.edu/php/chet/bash/FAQ I've read several times that section but I'm not sure how to use the IFS. IFS is only useful if you're splitting the fields of the line into separate variables

Re: try to open file descriptor for input with 'exec' fails

2007-11-02 Thread Paul Jarc
[EMAIL PROTECTED] wrote: ./doit: line 29: exec: 3: not found This is the line where i try to open the file descriptor for input: exec ${fd}$inf Try this: eval exec ${fd} '$inf' And likewise, when closing the descriptor: eval exec ${fd}- paul

Re: Problem with reading file and executing other stuffs?

2007-11-02 Thread Paul Jarc
Horinius [EMAIL PROTECTED] wrote: Is there any pitfall using this solution of yours? You talked about regular file, what's that supposed to be? Text file vs binary file? No, just that it doesn't work for pipes, so the data you're reading has to be in a named file, not produced as the output

Re: Problem with reading file and executing other stuffs?

2007-11-01 Thread Paul Jarc
Horinius [EMAIL PROTECTED] wrote: cat test.txt | while read line Read entry E4 in the bash FAQ: http://tiswww.case.edu/php/chet/bash/FAQ paul

Re: Running commands from array in a child script

2007-10-26 Thread Paul Jarc
bengoavs [EMAIL PROTECTED] wrote: CMDS=(ls -l /tmp/log) ~/child.sh ${CMDS[0]} child.sh: for i in $@ do if [ $i ]; then echo $i $i Redirections and other special characters are not treated specially if they are produced by a variable expansion. In

Re: Evaluating a variable within a variable

2007-10-23 Thread Paul Jarc
TimtheEagle [EMAIL PROTECTED] wrote: main_auth=7 f=main t=auth ile=$f_$t echo $ile Either: echo ${!ile} Or: eval echo \\$$ile\ paul

Re: Bash Prompt location

2007-09-21 Thread Paul Jarc
hirochiamaru [EMAIL PROTECTED] wrote: I saw it on a screen shot once, but this gentlemen was able to put the bash prompt at the bottom of his xterm window with out fill the top portion the xterm window first. yes '' | head -n $LINES paul

Re: [ -n ${emptyvariable} ] returns success

2007-09-20 Thread Paul Jarc
[EMAIL PROTECTED] wrote: foo= [ -n ${foo} ] echo true Prints true. That's the correct behavior. Should probably print an error, since after the command is expanded there are only three arguments, so the final ] should be interpreted as the argument to

Re: PATH strange behaviour

2007-08-03 Thread Paul Jarc
Jérémy Hervé [EMAIL PROTECTED] wrote: [EMAIL PROTECTED]:/usr/bin# httpd -v -bash: /usr/sbin/httpd: No such file or directory hash -r will fix that. See help hash and man bash for details. paul ___ Bug-bash mailing list Bug-bash@gnu.org

Re: Exit-on-error option does not work as expected

2007-07-17 Thread Paul Jarc
[EMAIL PROTECTED] wrote: My claim is that in the attached script, the 'false' command should *not* be considered to be a part of the list. Nevertheless, it is. The current behavior is too well-entrenched to change it, so the most reliable way to get the behavior you want is to

Re: Assigning variable value in right behalf of pipeline has no effect

2007-07-05 Thread Paul Jarc
[EMAIL PROTECTED] wrote: XXX=10; { XXX=20; } | read; echo $XXX It's clear that 'read' is executed as an separate process and its result (REPLY variable value) is lost but 'XXX=20' command is done by the same process as 'XXX=10'. No, every element of a pipeline is executed in its own

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

2007-06-25 Thread Paul Jarc
Matthew Woehlke [EMAIL PROTECTED] wrote: Stephane Chazelas wrote: [ -n $foo -a -n $bar ] is not the expression to test whether both $foo and $bar are non-empty, as it would fail for some specific values of $foo or $bar (try it when $foo contains = for instance). Huh? Why would having an '='

Re: Bash command completion when not connected to a terminal

2007-06-06 Thread Paul Jarc
raner [EMAIL PROTECTED] wrote: The completion seems to work, but I do not receive the completed filename from the shell's stdout. It's written to stderr, not stdout. paul ___ Bug-bash mailing list Bug-bash@gnu.org

Re: variable lost when while loop piped

2007-06-02 Thread Paul Jarc
[EMAIL PROTECTED] wrote: A variable set inside a while loop loses its value if the while loop is piped to a command, e.g., sed. This is normal. Read entry E4 in the bash FAQ. paul ___ Bug-bash mailing list Bug-bash@gnu.org

Re: Pattern replacement inconsistency

2007-05-30 Thread Paul Jarc
Chet Ramey [EMAIL PROTECTED] wrote: Anchored pattern matches that specify removing or replacing each match don't make sense. The combination is meaningless. It seems meaningful to me, but since only one occurrence could match an anchored pattern, every match just means the same thing as the

Re: Timing an operation

2007-05-24 Thread Paul Jarc
Matthew_S [EMAIL PROTECTED] wrote: Can i have something like; if difference between dates 5seconds echo fail fi date1=`perl -e 'print time()'` ... date2=`perl -e 'print time()'` interval=`expr $date2 - $date1` if test 5 -gt $interval; then echo fail fi On some systems, you could also

Re: backwards menu-complete with shift+tab

2007-05-14 Thread Paul Jarc
[EMAIL PROTECTED] wrote: Specifying the key combo shift+tab is not documented. Your terminal program probably doesn't distinguish tab from shift+tab. To check, try running od, and type tab, enter, shift+tab, enter, and see if od prints the same codes for both. paul

Re: Generating unique file names

2007-05-13 Thread Paul Jarc
matte [EMAIL PROTECTED] wrote: The count would be sufficient, as each folder will always hold ONLY these archives, and no hidden files. Thus, my directory would be: myArcName_1.tar.gz myArcName_2.tar.gz myArcName_3.tar.gz This will do it, starting the numbering at 0: set

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

2007-04-30 Thread Paul Jarc
Richard Neill [EMAIL PROTECTED] wrote: I thought testing for overflow was quite simple? Isn't it just a case of looking at the carry-bit, and seeing whether it gets set? That's usually how it's done in assembly. In C, it's somewhat more compilcated. For example: result=a*b; if (result/a!=b)

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

2007-04-30 Thread Paul Jarc
Andreas Schwab [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Paul Jarc) writes: result=a*b; if (result/a!=b) { report overflow; } That won't work, since (signed integer) overflow is undefined in C. A compiler is allowed to optimize the condition to false. Right, operations would have

Re: Problem with array element assignment

2007-04-15 Thread Paul Jarc
homac [EMAIL PROTECTED] wrote: cat test.txt | while read s l ; do Read entry E4 in the bash FAQ: http://tiswww.case.edu/php/chet/bash/FAQ paul ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash

Re: Syntax question

2007-03-24 Thread Paul Jarc
Caleb Cushing [EMAIL PROTECTED] wrote: the line FEATURES=parallel-fetch ccache distlocks# userfetch userpriv usersandbox I was told my bug is not a bug because there was no space in between the # putting a space does fix the problem but I can't recall that I've ever seen any documentation

Re: parameter expansion malinterpretation

2007-03-08 Thread Paul Jarc
[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] ~ $ hello=hello; echo ${hello:-1} Read entry E12 in the bash FAQ. paul ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash

Re: while read subcommand problem

2007-03-02 Thread Paul Jarc
Andreas Schwab [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Paul Jarc) writes: while ...; do var=...; done EOT $(generate-input-for-while) EOT use $var This has the disadvantage that generator and consumer no longer run concurrently. Process substitution does not have this problem. True

Re: /etc/bash.bashrc derivation and misuses

2007-02-25 Thread Paul Jarc
Chet Ramey [EMAIL PROTECTED] wrote: In my opinion, if a system vendor chooses to enable that sort of functionality (and many do, for all sorts of reasons), then they need to add something to the documentation noting that. Could that be done automatically by ./configure when this is enabled?

Re: Just created alias doesn't work in a string of commands

2007-02-08 Thread Paul Jarc
Gurjeet Singh [EMAIL PROTECTED] wrote: 1$ cat setenv.sh #!/bin/sh alias llrt='ls -lrt' ... 5$ . ./setenv.sh llrt . ./unsetenv.sh sh: llrt: command not found Aliases are expanded when a command is read, not when it is executed. The entire chain of commands forms a single compound command,

Re: reading the first colums of text file

2007-02-03 Thread Paul Jarc
Brian J. Murrell [EMAIL PROTECTED] wrote: (cat $file) http://partmaps.org/era/unix/award.html paul ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash

Re: can't pass a response from bash script to an app's interactive dialog

2007-01-25 Thread Paul Jarc
snowcrash+bugbash [EMAIL PROTECTED] wrote: CMD=$GPG --output revoke.txt --gen-revoke $ME /usr/bin/expect -c \ spawn `$CMD`;\ stty -echo;\ expect 'Create a revocation certificate for this key? (y/N) ';\ send 'y\n' You have backticks around $CMD. That means bash will run the gpg

Re: man page -c explanation clarity

2007-01-23 Thread Paul Jarc
Paul A. Clarke [EMAIL PROTECTED] wrote: The man page states, for the -c option: -c string If the -c option is present, then commands are read from string. If there are arguments after the string, they are assigned to the positional parameters,

Re: long lines not wrapping correctly in Mac OS X

2007-01-17 Thread Paul Jarc
agl [EMAIL PROTECTED] wrote: PS1=$'\[\e]2;\]\h\[\a\]\h:\w \u\$ ' Try this: PS1=$'\[\e]2;\h\a\]\h:\w \u\$ ' The first \h doesn't move the cursor position, so it should be kept within \[ and \] along with the escape sequences. paul ___ Bug-bash

Re: Quotes problem ?

2007-01-11 Thread Paul Jarc
Markos [EMAIL PROTECTED] wrote: You said that line cd $path should be better with quotes to avoid problems with dir names containing spaces, so did you mean this? cd $path Yes. paul ___ Bug-bash mailing list Bug-bash@gnu.org

Re: Quotes problem ?

2007-01-10 Thread Paul Jarc
Markos [EMAIL PROTECTED] wrote: #Delete logo_1.gif string from every line in results_1, #leaving only the path to prepare for cd step sed 's/logo_1.gif//' /tmp/results_1 /tmp/results This would be more precisely expressed as: sed 's:/logo_1\.gif$:/:' /tmp/results_1 /tmp/results If you happen

Re: mkfifo and tee within a function

2006-11-28 Thread Paul Jarc
Nathan Coulter [EMAIL PROTECTED] wrote: My real goal is to feed data to a function and then source it: $ cmd_print () { mkfifo zout ; (cat - zout ) ; source zout ; rm zout; } $ cmd_print EOF $ date $ EOF $ As Andreas said, this will be problematic using a fifo. You could do it with a

Re: Why is this executed inside a subshell?

2006-11-27 Thread Paul Jarc
Com MN PG P E B Consultant 3 [EMAIL PROTECTED] wrote: But it seems that within a $(...), even shell functions are executed in a child process. Is this supposed to work that way? Yes. $() passes the output of the inner command to the outer shell via a pipe, with the inner command running in a

Re: botched configure check for /dev/stdin

2006-11-15 Thread Paul Jarc
Chet Ramey [EMAIL PROTECTED] wrote: Hardcoding `/bin/test' is a tricky business: How about (exec test ...)? Or env test ...? paul ___ 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 Paul Jarc
mwoehlke [EMAIL PROTECTED] wrote: And since when does '#! /bin/bash' mean use whatever 'bash' you find in $PATH? Silly me, I thought it meant use '/bin/bash'. Dave did say hash-bang, but he didn't say #! /bin/bash. Possibly he's thinking of #!/usr/bin/env bash, which should do what you want.

Re: Tilde expansion not performed during variable evaluation

2006-10-10 Thread Paul Jarc
Karen Etheridge [EMAIL PROTECTED] wrote: Tilde expansion is not being performed when variables are being evaluated. That's normal, documented behavior. man bash, EXPANSION: The order of expansions is: brace expansion, tilde expansion, parameter, variable and arithmetic

Re: ...Limitation?

2006-09-26 Thread Paul Jarc
mwoehlke [EMAIL PROTECTED] wrote: I am trying to figure out how to run a command and pipe the output through tee, and then check the status of the original command. This uses a bash-specific feature: cmd (tee file); status=$? This should work on any sh: exec 31 status=`exec 41 { cmd; echo

Re: [BUG][bash][auto completion] if COMPREPLY contents : auto completion doesn't work properly

2006-09-26 Thread Paul Jarc
Chet Ramey [EMAIL PROTECTED] wrote: Vasily Tarasov wrote: I suppose I've found a bug; I need to make this part of the FAQ. The `:' is special to readline: it splits words for the word completion code. That explains some of what's going on in this case, but not all. For the first tab,

Re: [BUG][bash][auto completion] if COMPREPLY contents : auto completion doesn't work properly

2006-09-26 Thread Paul Jarc
Chet Ramey [EMAIL PROTECTED] wrote: Chet Ramey [EMAIL PROTECTED] wrote: Also, after two tabs, we have qwe:qwe:o, but further tabs don't add any more qwe:'s for some reason I don't understand. Because the colon is still a word break character, and readline passes `o' to the completion

Re: no parameter expansion and no special meaning to control operator

2006-09-26 Thread Paul Jarc
Lorenzo Viali [EMAIL PROTECTED] wrote: eval \$CMDFILE\ $list because i need $CMDFILE to receive more than one argument; but what happens is that if in the script's option's arguments, there are substrings like $i, those variable are expanded That will also happen within

Re: completion hosed by :

2006-09-07 Thread Paul Jarc
Ilya N. Golubev [EMAIL PROTECTED] wrote: If `0:0', `0i', `0.tar' files exists in current directory, `0:' is completed with `0\:0' to obtain `0:0\:0'. Using 3.0.16 or 3.1.17, only 0 is added by completion for me. So I end up with 0:0, and further TABs show me the three possible matches. What

Re: make bash use authentication type?

2006-09-07 Thread Paul Jarc
Jaqui Greenlees [EMAIL PROTECTED] wrote: In a recet discussion about ssh, the ida was put forth to get opnssh to export a variable that defines the authentication method used. The idea being to limit access to su use to only those authenticating through a public / privat key pairing. is

Re: process null-delimited input

2006-09-07 Thread Paul Jarc
Nathan Coulter [EMAIL PROTECTED] wrote: cat 0 | xargs -0 -n2 bash -c ' This is beside the point, but 0 is a no-op and be removed. Same for cat |. paul ___ Bug-bash mailing list Bug-bash@gnu.org

Re: completion inconsistencies involving symlinks

2006-09-06 Thread Paul Jarc
Kartik K. Agaram [EMAIL PROTECTED] wrote: I conclude that the 'logical path' is maintained only by the shell, not in the filesystem. If I'm right, then the whole notion of logical path is a leaky abstraction honored only by 'cd -L' (are there any others?). I would really like to be

Re: incorrect brace expansion when using default values

2006-09-05 Thread Paul Jarc
Mike Frysinger [EMAIL PROTECTED] wrote: this little bit of code doesnt work right: foo() { echo ${1:-a{b,c}} ; } Brace expansion happens before parameter expansion (man bash, EXPANSION). So the first } ends the parameter expression, and the second } isn't special. The result of parameter

Re: functions and set -e

2006-08-29 Thread Paul Jarc
Greg Schafer [EMAIL PROTECTED] wrote: #!/bin/sh set -e func () { false echo false true echo true false echo false } func echo done It never echoes done because func() returns 1. That's the correct behavior. The last false within the function does not immediately cause

Re: functions and set -e

2006-08-29 Thread Paul Jarc
Greg Schafer [EMAIL PROTECTED] wrote: Thanks for trying to clarify it for me. Let me put it another way: If I change Line 1 above to an if/then style statement instead of ie: if false; then echo false; fi it works exactly like I'd expect instead of the counter-intuitive behavior when

Re: Espace characters need -e, wrong behaviour

2006-08-21 Thread Paul Jarc
Nico Schottelius [EMAIL PROTECTED] wrote: Please remove the need for -e and ignore -e for a some time, until it vanished from user programs. There is too much variation among implementations of echo to ever hope for uniformity. Different implementations all react differently to options

Re: Job queing

2006-08-21 Thread Paul Jarc
Mårten Segerkvist [EMAIL PROTECTED] wrote: i. e. being able to split a one-liner like: command1 command2 command3 into several, separate command lines: You can write that one-liner on multiple lines: command1 command2 command3 paul ___

Re: Bug with 'test' built-in.

2006-08-10 Thread Paul Jarc
John Wenker [EMAIL PROTECTED] wrote: The following construct _always_ evaluates true, regardless of whether the file exists or not. if [ ! -a file ]; then echo This line always prints no matter what. else echo This line never prints.

Re: Bug with 'test' built-in.

2006-08-10 Thread Paul Jarc
mwoehlke [EMAIL PROTECTED] wrote: I *know* '! [ -a file ]' is not portable. I tried to use it in some script, somewhere, at some time, and it was sometimes treated as history expansion. Quoting the ! would take care of that particular problem, but there are some older shells, like Solaris

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

2006-07-31 Thread Paul Jarc
mwoehlke [EMAIL PROTECTED] wrote: Poor Yorick wrote: The following line does not perform the echo command. : ${FAKEVAR?} || echo hello What you probably want is: [ $FAKEVAR ] || echo hello That doesn't distinguish between an unset variable and a variable set to an empty value. If that

  1   2   >