Re: starstar "**" symbol

2012-03-30 Thread Clark J. Wang
On Wed, Dec 28, 2011 at 04:31, aleksandergajewski < aleksandergajew...@gmail.com> wrote: > Hi, i've just come across vim startstar symbol - here's note from vim > help: > > << CUT HERE >> > The usage of '*' is quite simple: It matches 0 or more characters. > In a > search pattern this would be

Re: [bug] Home dir in PS1 not abbreviated to tilde

2012-03-12 Thread Clark J. Wang
On Mon, Mar 12, 2012 at 12:22, Yongzhi Pan wrote: > Tested in GNU bash, version 3.00.16(1)-release and 4.1.2(1)-release. > > Upon login, home dir is displayed as tilde in PS1: > pan@BJ-APN-2 ~$ echo $PS1 > \[\033[35m\]\u@\h \w$ \[\033[0m\] > pan@BJ-APN-2 ~$ pwd > /export/home/pan/ > > After a cd

Re: RFE: allow bash to have libraries

2012-03-01 Thread Clark J. Wang
On Fri, Mar 2, 2012 at 08:20, John Kearney wrote: > :) :)) > Personal best wrote about 1 lines of code which finally became > about 200ish to implement a readkey function. > > Actually ended up with 2 solutions 1 basted on a full bash script > vt100 parser weighing in a about 500 lines inclu

Re: equivalent of Linux readlink -f in pure bash?

2012-01-09 Thread Clark J. Wang
On Wed, Aug 10, 2011 at 18:47, Stephane CHAZELAS wrote: > 2011-08-10, 12:00(+02), Bernd Eggink: > [...] > > function f > > { > > local OPTIND=1 > > > > echo "\$1=$1" > > } > > > > while getopts "abcdefg" opt > > do > > echo "opt=$opt" > > f $opt > > done > > --

Re: Specify completion without name

2012-01-05 Thread Clark J. Wang
On Fri, Jan 6, 2012 at 00:33, Peng Yu wrote: > > I would envision that such a completion function would assemble its list > > of possible completions by using your read-from-a-file mechanism and > > augment the list using compgen -a/compgen -b/compgen -A function. It > > would probably also want

Re: super annoying completion change

2011-12-09 Thread Clark J. Wang
On Fri, Dec 9, 2011 at 11:24, Chet Ramey wrote: > On 12/8/11 9:14 PM, Clark J. Wang wrote: > > > http://lists.gnu.org/archive/html/bug-bash/2011-09/msg7.html > > contains a basic summary and includes a patch that adds a `direxpand' > > shell optio

Re: extglob pattern: @(/root) vs. @(root)

2011-12-09 Thread Clark J. Wang
On Fri, Dec 9, 2011 at 20:12, Stephane CHAZELAS wrote: > 2011-12-9, 16:16(+08), Clark J. Wang: > > See following: > > > > # shopt extglob > > extglob on > > # echo $BASH_VERSION > > 4.2.20(1)-release > > # ls -d /root > > /root >

Re: extglob pattern: @(/root) vs. @(root)

2011-12-09 Thread Clark J. Wang
On Fri, Dec 9, 2011 at 16:16, Clark J. Wang wrote: > See following: > > # shopt extglob > extglob on > # echo $BASH_VERSION > 4.2.20(1)-release > # ls -d /root > /root > # pwd > / > # echo @(root) > root > # echo @(/root) > @(/root) <-- ??? &

extglob pattern: @(/root) vs. @(root)

2011-12-09 Thread Clark J. Wang
See following: # shopt extglob extglob on # echo $BASH_VERSION 4.2.20(1)-release # ls -d /root /root # pwd / # echo @(root) root # echo @(/root) @(/root) <-- ??? # echo @(/root*) @(/root*) <-- ??? # I'm confused why @(/root) and @(/root*) do not work here. -- -Clark

Re: super annoying completion change

2011-12-08 Thread Clark J. Wang
On Thu, Dec 8, 2011 at 23:58, Chet Ramey wrote: > On 12/7/11 9:43 PM, Miles Bader wrote: > > I notice that recently the behavior of bash completion w/r/t > > environment variables has changed, in a realy annoying way: > > This has enjoyed detailed discussion in the past, on several occasions.

Re: A programmable completoin bug?

2011-12-04 Thread Clark J. Wang
On Mon, Dec 5, 2011 at 13:15, Clark J. Wang wrote: > On Mon, Dec 5, 2011 at 11:42, Chet Ramey wrote: > >> On 12/4/11 10:26 PM, Clark J. Wang wrote: >> > On Mon, Dec 5, 2011 at 11:10, Chet Ramey > > <mailto:chet.ra...@case.edu>> wrote: >> > >> &

Re: A programmable completoin bug?

2011-12-04 Thread Clark J. Wang
On Mon, Dec 5, 2011 at 11:42, Chet Ramey wrote: > On 12/4/11 10:26 PM, Clark J. Wang wrote: > > On Mon, Dec 5, 2011 at 11:10, Chet Ramey > <mailto:chet.ra...@case.edu>> wrote: > > > > > > I still can't reproduce it on Mac OS X or RHEL 5.7: >

Re: A programmable completoin bug?

2011-12-04 Thread Clark J. Wang
On Mon, Dec 5, 2011 at 11:10, Chet Ramey wrote: > > I still can't reproduce it on Mac OS X or RHEL 5.7: > It's weird. :) Any other settings can affect this? What can I do to debug more? > > $ echo $BASH_VERSION > 4.2.20(8)-release > $ type -a compspec_foo > compspec_foo is a function > compspe

Re: A programmable completoin bug?

2011-12-04 Thread Clark J. Wang
On Sat, Dec 3, 2011 at 09:32, Chet Ramey wrote: > On 11/30/11 2:08 AM, Clark J. Wang wrote: > > (Tested with bash 4.2.10 and 4.1.9) > > > > [bash-4.2.10] # cat foo.compspec > > compspec_foo() > > { > > local cmd=$1 cur=$2 pre=$3 > > > >

A programmable completoin bug?

2011-11-29 Thread Clark J. Wang
(Tested with bash 4.2.10 and 4.1.9) [bash-4.2.10] # cat foo.compspec compspec_foo() { local cmd=$1 cur=$2 pre=$3 if [[ $cur = :* ]]; then COMPREPLY=( changed changed/IGNORE_ME ) fi } complete -F compspec_foo foo [bash-4.2.10] # source foo.compspec [bash-4.2.10] # foo :short [

Re: help-b...@gnu.org mailing list

2011-11-21 Thread Clark J. Wang
On Tue, Nov 22, 2011 at 12:05 PM, Bob Proulx wrote: > Chet Ramey wrote: > > Clark J. Wang wrote: > > > Chet Ramey wrote: > > > I just created help-b...@gnu.org <mailto:help-b...@gnu.org>. I > hope > > > that it becomes the list where >

Re: help-b...@gnu.org mailing list

2011-11-21 Thread Clark J. Wang
On Tue, Nov 22, 2011 at 7:50 AM, Chet Ramey wrote: > I just created help-b...@gnu.org. I hope that it becomes the list where > folks ask questions about bash and shell programming. Please socialize > its existence and subscribe if you like. > So the "About bug-bash" description should be updat

Re: Encrypted bashrc?

2011-11-13 Thread Clark J. Wang
On Fri, Nov 11, 2011 at 9:09 PM, Greg Wooledge wrote: > > > On Fri, Nov 11, 2011 at 01:48:59PM +0800, Clark J. Wang wrote: > > > > In my company all the people share a few of Solaris servers which use > > > > NIS to manage user accounts. The bad thing is that som

Re: Encrypted bashrc?

2011-11-11 Thread Clark J. Wang
On Fri, Nov 11, 2011 at 2:25 PM, William Park wrote: > On Fri, Nov 11, 2011 at 01:48:59PM +0800, Clark J. Wang wrote: > > In my company all the people share a few of Solaris servers which use > > NIS to manage user accounts. The bad thing is that some servers' root > >

Encrypted bashrc?

2011-11-10 Thread Clark J. Wang
In my company all the people share a few of Solaris servers which use NIS to manage user accounts. The bad thing is that some servers' root passwords are well known so anybody can easily su to my account to access my files. To protect some private info in my bashrc I want to encrypt it. Any one has

Re: What is the best to pass an array with specially characters as command line arguments?

2011-11-06 Thread Clark J. Wang
On Mon, Nov 7, 2011 at 12:56 PM, Peng Yu wrote: > Hi Clark, > > >> > v=" a b c ( a'b | " > >> > a=( $v ) > >> > echo "${a[@]}" > > > > There's a @ char here. > > I see. It's my mistake. > > But I want to pass the 6 short arguments instead of 1 long argument to > echo. What do you mean by "1 lo

Re: What is the best to pass an array with specially characters as command line arguments?

2011-11-06 Thread Clark J. Wang
(Added back the bash list) On Mon, Nov 7, 2011 at 11:50 AM, Peng Yu wrote: > On Sun, Nov 6, 2011 at 9:30 PM, Clark J. Wang wrote: > > On Mon, Nov 7, 2011 at 11:02 AM, Peng Yu wrote: > >> > >> Hi, > >> > >> Suppose that I have a verbatim string &

Re: bash tab variable expansion question?

2011-09-04 Thread Clark J. Wang
On Sat, Sep 3, 2011 at 3:32 AM, Chet Ramey wrote: > > The attached patch adds a new shell option that, when enabled, is > intended to restore the bash-4.1 behavior of expanding directory names > in filenames being completed. I have done some testing, and it seems > to work the way I intend. Thi

Re: equivalent of Linux readlink -f in pure bash?

2011-08-10 Thread Clark J. Wang
On Wed, Aug 10, 2011 at 6:00 PM, Bernd Eggink wrote: > On 09.08.2011 15:50, Steven W. Orr wrote: > > *) You reset OPTIND to 1 but you didn't declare it local. This will >> cause any caller of getlink which uses getopts to reset its variable >> to 1. (I mention this because it cost me a couple of

Re: Is bash dying or dead (was Re: 4.1 is "$((( ))) an 'official operator, if $(( )) isn't?

2011-08-10 Thread Clark J. Wang
On Thu, Aug 11, 2011 at 5:59 AM, Linda Walsh wrote: > > Bash is becoming very unstable -- programs that work in 3.1 won't > necessarily work in 3.2, those in 3.2 aren't compat with 4.0, 4.0 is > different than 4.1, and now 4.2 is different than 4.1. > > How can people write stable scripts in an e

Re: bash completion

2011-08-08 Thread Clark J. Wang
On Sun, Aug 7, 2011 at 11:35 PM, jonathan MERCIER wrote: > I have a bash completion file (see below) > It works fine, but i would like add a feature => not expand the flag by > a space when it contain '=' > curently when i do: > $ ldc2 -Df > ldc2 -Df=⊔ > i would like: > ldc2 -Df > ldc2 -Df= > > w

Re: feature request: option to start script not from the very beginning of file

2011-08-02 Thread Clark J. Wang
On Tue, Aug 2, 2011 at 10:34 PM, Steven W. Orr wrote: > On 8/2/2011 9:05 AM, Dmitry Bolshakov wrote: > >> hi >> >> perl has "-x" switch which makes it skip leading file contents until the >> #!/bin/perl >> line >> >> imho it would be good to have the same feature in bash >> >> > Huge misteak. The

Re: ``complete -d -o default cd'' issue

2011-07-26 Thread Clark J. Wang
On Wed, Jul 27, 2011 at 12:39 AM, Chet Ramey wrote: > > Globbing is not part of readline's set of filename completions. It is > implemented by the shell, hence the need for the bashdefault option. > Thanks all for the explanation. > > -- > ``The lyf so short, the craft so long to lerne.'' - Ch

Re: ``complete -d -o default cd'' issue

2011-07-25 Thread Clark J. Wang
On Tue, Jul 26, 2011 at 12:00 AM, Andreas Schwab wrote: > "Clark J. Wang" writes: > > > Here the cannot expand ``*.d'' to ``long-dir-name.d''. Bug? > > You need to add -o bashdefault for that. > ``-o bashdefault'' works fine

``complete -d -o default cd'' issue

2011-07-25 Thread Clark J. Wang
For example: [bash-4.2.8] # ls -lF total 4 drwxr-xr-x 3 root root 4096 2011-07-25 16:52 long-dir-name.d/ [bash-4.2.8] # ls -lF long-dir-name.d/ total 4 drwxr-xr-x 2 root root 4096 2011-07-25 16:52 bar/ [bash-4.2.8] # complete -d -o default cd [bash-4.2.8] # cd *.d Here the cannot expand ``*.d''

reverse-i-search not work fine when mapping jj to ESC in vi mode

2011-07-12 Thread Clark J. Wang
Try like this: [bash-4.2.8] # set -o vi [bash-4.2.8] # bind -m vi-insert '"jj": "\e"' [bash-4.2.8] # echo jk [bash-4.2.8] # echo k [bash-4.2.8] # Then press ctrl-r and enter jk to search. It'll find ``echo k'' instead of ``echo jk''. Bug?

Re: Signals ignored by a shell cannot be handled by its sub-shells?

2011-07-12 Thread Clark J. Wang
On Tue, Jul 12, 2011 at 3:34 PM, Andreas Schwab wrote: > "Clark J. Wang" writes: > > > For example: > > > > [bash-4.2.8] # cat a.sh > > trap '' TERM > > bash b.sh > > [bash-4.2.8] # cat b.sh > > echo "Now in $0 ..."

Signals ignored by a shell cannot be handled by its sub-shells?

2011-07-11 Thread Clark J. Wang
For example: [bash-4.2.8] # cat a.sh trap '' TERM bash b.sh [bash-4.2.8] # cat b.sh echo "Now in $0 ..." trap sig_TERM TERM sig_TERM() { echo "got SIGTERM, exiting ..." exit } kill -TERM $$ sleep 1 echo "Not killed?" [bash-4.2.8] # bash a.sh Now in b.sh ... Not killed? [bash-4.2.8] # -Cla

Re: path completion with cd - similar to tcsh

2011-04-15 Thread Clark J. Wang
placed by a slash when doing "cd ... "? > > Best > > -- > Peter Toft, PhD > http://petertoft.dk > > That also annoys me much. Try like this: $ complete -o default -o nospace -d cd $ cd $VAR/ -- Clark J. Wang

Re: multi line bash commands in a Makefile

2011-04-10 Thread Clark J. Wang
On Sun, Apr 10, 2011 at 7:30 PM, ali hagigat wrote: > Thanks Clark for the reply. 'count' is set by shell before doing make. like > root> count=0 > > Have you exported the 'count' var before invoking make? > On Sun, Apr 10, 2011 at 3:10 PM, Clark J. Wang

Re: multi line bash commands in a Makefile

2011-04-10 Thread Clark J. Wang
;echo ppp" > makefile27;count=1;fi > /bin/sh: line 0: test: -eq: unary operator expected > var1= > > Why it complains about needing a unary operator? > > -- Clark J. Wang

Re: RFE: make [[ compatible with [ 'Option'?

2011-03-28 Thread Clark J. Wang
s: if [[ $filename = *.log ]]; then echo ...; fi You'll often see multiple matches for the above pattern. :) > -- > Clark J. Wang

Re: BASH_SUBSHELL documentation misleading

2011-03-24 Thread Clark J. Wang
of how many subshells were created as children of the current shell in > the past. That's where Sam got mixed up. > > Agree. It's not complicated compared to, for example, =~ usage. :) -- Clark J. Wang

[suggestion] Also document users' requirements for new features

2011-03-10 Thread Clark J. Wang
/tct/tip) and Python has PEP (Python Enhancement Proposal: http://www.python.org/dev/peps/). -- Clark J. Wang

Re: case modification won't work with pattern

2011-03-10 Thread Clark J. Wang
On Fri, Mar 11, 2011 at 11:33 AM, Chet Ramey wrote: > On 3/10/11 9:04 PM, Clark J. Wang wrote: > > > > Agree. Almost all of the poeple around me don't understand why it works > that > > way. Maybe some background of the feature requirement can help us to > >

Re: case modification won't work with pattern

2011-03-10 Thread Clark J. Wang
http://cfajohnson.com/> > Author: > Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress) > Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) > > -- Clark J. Wang

Re: Hightlighting in bash

2011-03-10 Thread Clark J. Wang
r messages from mundane but profuse > output that logs commands being invoked, etc. > > Does this seem doable? > > Thanks, > > -Philip > > > -- Clark J. Wang

Re: case modification won't work with pattern

2011-03-10 Thread Clark J. Wang
> does is compare the *first character* of var to the *glob pattern* which > follows the ^. If the character matches the glob, it gets capitalized. > > No single character is ever going to match the glob "ab", because it's > two characters long. > -- Clark J. Wang

Re: case modification won't work with pattern

2011-03-10 Thread Clark J. Wang
er than the *first* `a'. >echo "replace all \"a\" to uppercase: ${var^^a}" > >Then the result is: > >mylogin@Xubuntu:~/shell$ ./a.sh >var: abcabc >replace the leading "ab" to uppercase: abcabc --> incorrect >replace all the "ab" to uppercase: abcabc --> incorrect >replace the first "a" to uppercase: Abcabc --> correct >replace all "a" to uppercase: AbcAbc--> correct > > > Repeat-By: > > -- > Jerry Wang jerry.j.w...@alcatel-lucent.com > > -- Clark J. Wang

Re: case modification won't work with pattern

2011-03-10 Thread Clark J. Wang
ase: abcabc --> incorrect >replace all the "ab" to uppercase: abcabc --> incorrect >replace the first "a" to uppercase: Abcabc --> correct >replace all "a" to uppercase: AbcAbc--> correct > > > Repeat-By: > > -- > Jerry Wang jerry.j.w...@alcatel-lucent.com > > -- Clark J. Wang

Re: variable name and its' value are the same characters causes recursion error

2011-03-09 Thread Clark J. Wang
hmetic evaluation is found or > the expression recursion level exceeded. > > Actually I don't like the recursion here. Does POSIX require that? > For example: > > unset a; declare a="a"; [[ a -lt 3 ]]; echo $? > bash: [[: a: expression recursion level exceeded

Re: variable name and its' value are the same characters causes recursion error

2011-03-09 Thread Clark J. Wang
hmetic evaluation is found or > the expression recursion level exceeded. > > Agree. I didn't know it's recursive before. :) > For example: > > unset a; declare a="a"; [[ a -lt 3 ]]; echo $? > bash: [[: a: expression recursion level exceeded (error token is "a") > 1 > > Shouldn't the return code from this expression be 2, rather than 1? > > Thank you. > Peg > > > -- Clark J. Wang

Re: bash tab variable expansion question?

2011-02-27 Thread Clark J. Wang
.org > > GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 > > "And now for something completely different." > > -- Clark J. Wang

Re: bash tab variable expansion question?

2011-02-25 Thread Clark J. Wang
OME every time. (The same goes for command > substitution - bash should never pre-maturely lock me in to a single > expansion during tab completion.) > > -- > Eric Blake ebl...@redhat.com+1-801-349-2682 > Libvirt virtualization library http://libvirt.org > > -- Clark J. Wang

Re: bash tab variable expansion question?

2011-02-25 Thread Clark J. Wang
I typed, and I consider the 4.1 > > behavior to be the bug. > > Maybe, but then it shouldn't escape the $ either, as the OP is reporting > for > 4.2 (I don't have a 4.2 handy to test it). > > Agree, $ should not be escaped here which is different from pathname completion. -- Clark J. Wang

Re: Question. Autocomplete paths starting with %.

2011-02-24 Thread Clark J. Wang
On Thu, Feb 24, 2011 at 8:46 PM, d...@ucore.info wrote: > On Wed, Feb 23, 2011 at 5:06 AM, Clark J. Wang wrote: > > I can give you an example here: > > > > bash# vi compgen-example.sh > > _compgen_foo() > > { > > local cmd=$1 cur=$2 pre

Re: Question. Autocomplete paths starting with %.

2011-02-22 Thread Clark J. Wang
e: bash# vi compgen-example.sh _compgen_foo() { local cmd=$1 cur=$2 pre=$3 if [[ $cur = % ]]; then COMPREPLY[0]='it-works' fi } complete -F _compgen_foo foo bash# source compgen-example.sh bash# foo %<-- Press TAB here bash# foo it-works<-- `%' will be expanded like this -- Clark J. Wang

Re: How to match pattern in bash?

2011-02-22 Thread Clark J. Wang
; Reread the bash manual about [[ == ]]. > Is there such a build-in feature in bash? Or I have to rely on some > external program such as perl to test the pattern matching? > > -- > Regards, > Peng > > -- Clark J. Wang

Re: no way to give 'select' a default value

2011-02-22 Thread Clark J. Wang
; ... If the line is empty, WORDS and the prompt are redisplayed. > > `select' is extremely limited. If you need any kind of flexibility that > it doesn't offer, just scrap it and write your own while/read/test loop. > > Agree. I've never used `select' in my scripts. -- Clark J. Wang

Re: ``complete -b'' does not include ``coproc''

2011-02-21 Thread Clark J. Wang
On Mon, Feb 21, 2011 at 10:26 PM, Chet Ramey wrote: > On 2/21/11 3:55 AM, Clark J. Wang wrote: > > > And even ``helptopic'' does not show ``coproc'' either: > > > > # compgen -A helptopic co > > command > > compgen > > complete > &

Re: ``complete -b'' does not include ``coproc''

2011-02-21 Thread Clark J. Wang
On Mon, Feb 21, 2011 at 4:21 PM, Pierre Gaston wrote: > > > On Mon, Feb 21, 2011 at 10:12 AM, Clark J. Wang wrote: > >> Tested with 4.2: >> >> bash-4.2# complete -b help >> bash-4.2# help co >> command compgen complete compopt continue >&g

``complete -b'' does not include ``coproc''

2011-02-21 Thread Clark J. Wang
Tested with 4.2: bash-4.2# complete -b help bash-4.2# help co command compgen complete compopt continue bash-4.2# -- Clark J. Wang

Re: Why escape char `:' with `\' when auto completing filenames?

2011-02-20 Thread Clark J. Wang
On Mon, Feb 21, 2011 at 9:21 AM, Chet Ramey wrote: > On 2/18/11 6:52 AM, Clark J. Wang wrote: > > > > > Sth was wrong for my testing. I removed @ from COMP_WORDBREAKS but > > afterwards one bind command (bind "set bell-style none") added @ back. >

Re: Why escape char `:' with `\' when auto completing filenames?

2011-02-20 Thread Clark J. Wang
On Mon, Feb 21, 2011 at 9:21 AM, Chet Ramey wrote: > On 2/18/11 6:52 AM, Clark J. Wang wrote: > > > > > Sth was wrong for my testing. I removed @ from COMP_WORDBREAKS but > > afterwards one bind command (bind "set bell-style none") added @ back. >

Re: [bash4.2] ${v//[/} bug?

2011-02-20 Thread Clark J. Wang
On Sat, Feb 19, 2011 at 1:02 PM, Chet Ramey wrote: > On 2/15/11 10:16 PM, Clark J. Wang wrote: > > On Wed, Feb 16, 2011 at 9:59 AM, Chet Ramey > <mailto:chet.ra...@case.edu>> wrote: > > > > On 2/15/11 6:18 AM, Clark J. Wang wrote: > > > For

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-18 Thread Clark J. Wang
hat 3.1 behavior is much more straightforward for me to understand. -- Clark J. Wang

Re: [bash 4.2] `declare -g' bug?

2011-02-18 Thread Clark J. Wang
On Fri, Feb 18, 2011 at 9:35 PM, Greg Wooledge wrote: > On Fri, Feb 18, 2011 at 11:25:48AM +0800, Clark J. Wang wrote: > > A global var can always be declared out of a func (usually at the > beginning > > of the script) so what's the main intention of introducing a new `

Re: Why escape char `:' with `\' when auto completing filenames?

2011-02-18 Thread Clark J. Wang
On Fri, Feb 18, 2011 at 6:48 PM, Pierre Gaston wrote: > > > On Fri, Feb 18, 2011 at 12:17 PM, Clark J. Wang wrote: > >> On Fri, Feb 18, 2011 at 5:38 PM, Andreas Schwab > >wrote: >> >> > Maarten Billemont writes: >> > >> > > Why ar

Re: Why escape char `:' with `\' when auto completing filenames?

2011-02-18 Thread Clark J. Wang
On Fri, Feb 18, 2011 at 6:21 PM, Clark J. Wang wrote: > On Fri, Feb 18, 2011 at 6:02 AM, Chet Ramey wrote: > >> >> For pete's sake. If you don't think they should be word break characters, >> modify the value of COMP_WORDBREAKS. For the record, @ causes a wo

Re: Why escape char `:' with `\' when auto completing filenames?

2011-02-18 Thread Clark J. Wang
On Fri, Feb 18, 2011 at 6:36 PM, Andreas Schwab wrote: > "Clark J. Wang" writes: > > > On Fri, Feb 18, 2011 at 5:38 PM, Andreas Schwab >wrote: > > > >> Maarten Billemont writes: > >> > >> > Why are we escaping all word break ch

Re: Why escape char `:' with `\' when auto completing filenames?

2011-02-18 Thread Clark J. Wang
On Fri, Feb 18, 2011 at 5:38 PM, Andreas Schwab wrote: > Maarten Billemont writes: > > > Why are we escaping all word break characters? rm file:name and rm > file\:name are effectively identical, I'm not sure I see the need for > escaping it. > > How do you differentiate between completing file:n

Re: [bash 4.2] `declare -g' bug?

2011-02-17 Thread Clark J. Wang
On Fri, Feb 18, 2011 at 8:45 AM, Chet Ramey wrote: > > The -g option exists solely to create variables at the global scope. The > intent is that functions be able to declare global variables with > attributes if they desire. It doesn't change the scoping rules or > variable resolution behavior.

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Clark J. Wang
On Thu, Feb 17, 2011 at 11:04 PM, Andreas Schwab wrote: > "Clark J. Wang" writes: > > > The point is: ``Any part of the pattern may be quoted to force it to > be > > matched as a string.'' > > "it" == part of the pattern. > >

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Clark J. Wang
On Thu, Feb 17, 2011 at 11:02 PM, Greg Wooledge wrote: > On Thu, Feb 17, 2011 at 10:56:21PM +0800, Clark J. Wang wrote: > > The point is: ``Any part of the pattern may be quoted to force it to > be > > matched as a string.'' And backslash is one of bash'

Re: Why escape char `:' with `\' when auto completing filenames?

2011-02-17 Thread Clark J. Wang
On Thu, Feb 17, 2011 at 9:10 PM, Andreas Schwab wrote: > "Clark J. Wang" writes: > > > On Thu, Feb 17, 2011 at 6:19 PM, Andreas Schwab >wrote: > > > >> "Clark J. Wang" writes: > >> > >> > On Thu, Feb 17

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Clark J. Wang
On Thu, Feb 17, 2011 at 7:09 PM, Clark J. Wang wrote: > See following script output: > > bash-4.2# cat quoted-pattern.sh > [[ .a == \.a* ]] && echo 1 # not quoted > [[ aa =~ \.a* ]] && echo 2 # quoted > > [[ aa =~ \a. ]] && echo 3 # not quoted

Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Clark J. Wang
On Thu, Feb 17, 2011 at 9:20 PM, Andreas Schwab wrote: > "Clark J. Wang" writes: > > > See following script output: > > > > bash-4.2# cat quoted-pattern.sh > > [[ .a == \.a* ]] && echo 1 # not quoted > > [[ aa =~ \.a* ]] && ech

Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]

2011-02-17 Thread Clark J. Wang
See following script output: bash-4.2# cat quoted-pattern.sh [[ .a == \.a* ]] && echo 1 # not quoted [[ aa =~ \.a* ]] && echo 2 # quoted [[ aa =~ \a. ]] && echo 3 # not quoted [[ aa =~ \a\. ]] && echo 4 # quoted bash-4.2# bash42 quoted-pattern.sh 1 3 bash-4.2# >From my understanding 1 2 3 4

Re: Why escape char `:' with `\' when auto completing filenames?

2011-02-17 Thread Clark J. Wang
On Thu, Feb 17, 2011 at 6:19 PM, Andreas Schwab wrote: > "Clark J. Wang" writes: > > > On Thu, Feb 17, 2011 at 5:00 PM, Andreas Schwab >wrote: > > > >> "Clark J. Wang" writes: > >> > >> > I think char `:' is no

Re: Why escape char `:' with `\' when auto completing filenames?

2011-02-17 Thread Clark J. Wang
On Thu, Feb 17, 2011 at 5:00 PM, Andreas Schwab wrote: > "Clark J. Wang" writes: > > > I think char `:' is not special in bash. > > $ printf "%q\n" "$COMP_WORDBREAKS" > $' \t\n"\'><=;|&(:' > > I don&#x

Why escape char `:' with `\' when auto completing filenames?

2011-02-17 Thread Clark J. Wang
For example: # touch ifcfg-eth-id-00:0c:29:b5:71:d2 # ls ifcfg After pressing the the command line will become to: # ls ifcfg-eth-id-00\:0c\:29\:b5\:71\:d2 That's a bit annoying. I think char `:' is not special in bash. Any reasonable consideration for the behavior? -- Clark

Re: [bash 4.2] In vi mode, cc failed to change the whole line

2011-02-16 Thread Clark J. Wang
On Thu, Feb 17, 2011 at 12:43 PM, Clark J. Wang wrote: > # ldd /usr/local/bash-4.2.0/bin/bash > linux-gate.so.1 => (0xb773) > libncurses.so.5 => /lib/libncurses.so.5 (0xb76ec000) > libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xb76e8000) >

Re: Do more testing before a release?

2011-02-16 Thread Clark J. Wang
On Thu, Feb 17, 2011 at 1:38 PM, Mike Frysinger wrote: > On Wednesday, February 16, 2011 23:51:16 Clark J. Wang wrote: > > I know little about open source development process (and control?). I > just > > don't know where to get the bash code (like CVS, SVN respository) b

Do more testing before a release?

2011-02-16 Thread Clark J. Wang
I know little about open source development process (and control?). I just don't know where to get the bash code (like CVS, SVN respository) before it's released. I think it's better to make it open to more people so everyone can help review and test before a stable release. -- Clark

[bash 4.2] In vi mode, cc failed to change the whole line

2011-02-16 Thread Clark J. Wang
For example, in vi insert mode, I first enter a command like this: # hello world Then I press ESC and type cc, the cursor just moves to the beginning (under the char `h') and the whole line is not emptied. If I type more chars after cc, only the first `h' char is replaced and following `ello worl

Re: typeset -r prevents local variable of same name.

2011-02-16 Thread Clark J. Wang
On Thu, Feb 17, 2011 at 11:13 AM, Chet Ramey wrote: > On 2/13/11 3:17 PM, ste...@syslang.net wrote: > > Configuration Information [Automatically generated, do not change]: > > Machine: i386 > > OS: linux-gnu > > Compiler: gcc > > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' > -DCO

[bash 4.2] `declare -g' bug?

2011-02-16 Thread Clark J. Wang
See following script result: bash# cat declare-g.sh #!/bin/bash var=global f1() { declare var=local f2 echo 3.$var } f2() { declare -g var echo 1.$var var=global-changed echo 2.$var } f1 echo 4.$var bash# /usr/local/bash-4.2.0/bin/bash declare-g.sh 1.local 2.globa

Re: [bash4.2] ${v//[/} bug?

2011-02-15 Thread Clark J. Wang
On Wed, Feb 16, 2011 at 9:59 AM, Chet Ramey wrote: > On 2/15/11 6:18 AM, Clark J. Wang wrote: > > For following script: > > > > var='[hello' > > echo "${var//[/}" > > > > With bash 4.1 it outputs hello but with 4.2 it outputs [hello

Re: [bash4.2] ${v//[/} bug?

2011-02-15 Thread Clark J. Wang
On Wed, Feb 16, 2011 at 9:20 AM, Chet Ramey wrote: > On 2/15/11 6:18 AM, Clark J. Wang wrote: > > For following script: > > > > var='[hello' > > echo "${var//[/}" > > > > With bash 4.1 it outputs hello but with 4.2 it outputs [hello

[bash4.2] ${v//[/} bug?

2011-02-15 Thread Clark J. Wang
For following script: var='[hello' echo "${var//[/}" With bash 4.1 it outputs hello but with 4.2 it outputs [hello . And bash 4.2 with compat41 on still outputs [hello . Bug? Or Bug fixed? -- Clark

Re: Don't show help of `readonly' and `readarray' when I run `help read'

2011-02-11 Thread Clark J. Wang
I forgot to reply to all On Fri, Feb 11, 2011 at 11:15 PM, Chet Ramey wrote: > On 2/11/11 3:53 AM, Clark J. Wang wrote: > > > > > > On Thu, Feb 10, 2011 at 10:21 PM, Chet Ramey > <mailto:chet.ra...@case.edu>> wrote: > > > > On 2/10/11 4:03

Re: help's blank lines have four spaces appended

2011-02-11 Thread Clark J. Wang
On Fri, Feb 11, 2011 at 11:16 PM, Chet Ramey wrote: > On 2/11/11 4:02 AM, Clark J. Wang wrote: > > On Mon, Feb 7, 2011 at 12:01 AM, Chet Ramey > <mailto:chet.ra...@case.edu>> wrote: > > > > On 2/6/11 2:01 AM, jida...@jidanni.org <mailto:jida...@jidanni

Don't show help of `readonly' and `readarray' when I run `help read'

2011-02-10 Thread Clark J. Wang
help: help [-dms] [pattern ...] >From my understanding the *pattern* here must be a glob-style pattern (wildcard) so `readonly' does not match the pattern `read'. -- Clark

Re: help builtin bug ???

2011-01-20 Thread Clark J. Wang
2011/1/20 Sławomir Iwanek > hello, > > and what about this: > > $ help () > > it opens some program in an interactive mode (which one?). It seems like > it does not react on any command, like '?', giving the output: > > bash: błąd składni przy nieoczekiwanym znaczniku `?' > > (it's in Polish - me

Re: Making $! and $? searchable in the man page

2011-01-06 Thread Clark J. Wang
On Fri, Jan 7, 2011 at 1:33 AM, Greg Wooledge wrote: > On Thu, Jan 06, 2011 at 10:48:33AM +0100, Vidar Holen wrote: > > Hi, > > > > Finding the meaning of $? and $! in the man page is quite hard for people > > not familiar with the layout and bash terminology (this frequently comes > > up in Free

Re: Why `echo -n hello | while read v; do echo $v; done' prints nothing?

2010-12-02 Thread Clark J. Wang
On Thu, Dec 2, 2010 at 11:49 PM, Greg Wooledge wrote: > On Thu, Dec 02, 2010 at 07:04:57PM +0800, Clark J. Wang wrote: > > Following command also prints nothing, confused :( > > > > for ((i = 0; i < 10; ++i)); do echo -n " $i"; done | while read v; do > echo

Why `echo -n hello | while read v; do echo $v; done' prints nothing?

2010-12-02 Thread Clark J. Wang
Following command also prints nothing, confused :( for ((i = 0; i < 10; ++i)); do echo -n " $i"; done | while read v; do echo $v; done -- Clark

Re: how to silence shopt -s autocd verbose?

2010-11-28 Thread Clark J. Wang
On Sun, Nov 28, 2010 at 5:12 AM, some guy wrote: > > shopt -q doesn't silence shopt -s autocd (intuitively, after reading it's > description, i thought this was it's purpose, but is not.) > > `shopt -q' is usually used to check if a shopt option is turned on or off. For example: $ shopt -q autoc

Re: static vs. dynamic scoping

2010-11-10 Thread Clark J. Wang
On Wed, Nov 10, 2010 at 6:37 PM, Marc Herbert wrote: > Chris F.A. Johnson: > > I find the bash behaviour more logical, and I do use it in scripts. > > Examples? > > http://fvue.nl/wiki/Bash:_Passing_variables_by_reference , I like that.

Re: Trouble with PS1 special characters between \[ and \]

2010-10-31 Thread Clark J. Wang
2010/10/31 Lluís Batlle i Rossell > Hello, > > I don't think this problem is related to any recent bash version only. I've > seen > this since years I think. > > Nevertheless I'm using GNU bash, version 4.0.17(1)-release > (x86_64-unknown-linux-gnu) now. > > My PS1 uses the "Change window title"

Re: How is $"string" translated?

2010-08-30 Thread Clark J. Wang
On Mon, Aug 30, 2010 at 7:30 PM, Pierre Gaston wrote: > On Mon, Aug 30, 2010 at 1:35 PM, Clark J. Wang wrote: > > The Bash manual says: > > > > "A double-quoted string preceded by a dollar sign ($) will cause the > string > > to be translated according to

How is $"string" translated?

2010-08-30 Thread Clark J. Wang
The Bash manual says: "A double-quoted string preceded by a dollar sign ($) will cause the string to be translated according to the current locale. If the current locale is C or POSIX, the dollar sign is ignored. If the string is translated and replaced, the replacement is double-quoted." Any

Re: Issues when func name is the same with an alias

2010-08-05 Thread Clark J. Wang
On Fri, Aug 6, 2010 at 9:54 AM, Chris F.A. Johnson wrote: > On Fri, 6 Aug 2010, Clark J. Wang wrote: > > On Thu, Aug 5, 2010 at 4:06 PM, Marc Herbert >> wrote: >> >> Le 04/08/2010 15:29, Clark J. Wang a écrit : >>> >>>> I do not agree

Re: Issues when func name is the same with an alias

2010-08-05 Thread Clark J. Wang
On Thu, Aug 5, 2010 at 4:06 PM, Marc Herbert wrote: > Le 04/08/2010 15:29, Clark J. Wang a écrit : > > I do not agree. Aliases are much simpler to use than functions. > > Please provide examples. > > The following is a part of my aliases. I'll have to write much more co

Re: Issues when func name is the same with an alias

2010-08-04 Thread Clark J. Wang
On Wed, Aug 4, 2010 at 8:27 PM, Bernd Eggink wrote: > Am 04.08.2010 12:39, schrieb Clark J. Wang: > > I was testing the precedence between functions and aliases so I tried like >> this (with bash 4.1.5): >> >> $ cat rc >> alias foo='echo this is the alias

  1   2   >