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

2010-08-05 Thread Marc Herbert
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.





Re: RFE: allow double quotes to group multi-words be treated as 1 arg, w/DQ's stripped off -- including RH =~

2010-08-05 Thread Linda Walsh


On 8/4/2010 10:07 PM, Chet Ramey wrote:
 On 8/4/10 8:31 AM, Greg Wooledge wrote:
 
 In fact, putting the ERE-pattern you want to match against into a variable
 and then using =~ $variable *is* the recommended practice, if you need to
 use =~ at all.  It is the only way to get consistent results among all
 the different releases of bash that have =~, since the behavior changed
 multiple times during the 3.x series.
 
 All this is true (as is the text I removed), except that the behavior
 changed only once: to make quoted text remove any special meaning of
 the quoted characters to the regular expression matcher.
 
 Backwards compatibility, of course, means never having to say you're sorry,
 but it also means that you never get to fix anything.  The behavior change
 fixed a problem, as I saw it, with the initial implementation.  Without
 this change, there is no clean way to match a literal character that has a
 special meaning as a regexp operator.
 
 Chet
Couldn't you have limited to single quotes -- reserving to them the
function of literalizing what is between them.

Otherwise, could you think other characters you'd prefer to use to
group words separated by white-space, together to be matched in a pattern?

Or, why should double quotes be functionally the same as single quotes 
in that situation?




Re: RFE: allow double quotes to group multi-words be treated as 1 arg, w/DQ's stripped off -- including RH =~

2010-08-05 Thread Andreas Schwab
Linda Walsh b...@tlinx.org writes:

 Or, why should double quotes be functionally the same as single quotes 
 in that situation?

Handling it different from glob meta characters would make it even more
special.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
And now for something completely different.



Re: RFE: allow double quotes to group multi-words be treated as 1 arg, w/DQ's stripped off -- including RH =~

2010-08-05 Thread Chet Ramey
On 8/5/10 2:56 AM, Linda Walsh wrote:

 Couldn't you have limited to single quotes -- reserving to them the
 function of literalizing what is between them.

No.  That's not the difference between single and double quotes.  Why
would I complicate things further?

 Otherwise, could you think other characters you'd prefer to use to
 group words separated by white-space, together to be matched in a pattern?

And introduce another special character or two?  Thank you, no.

 Or, why should double quotes be functionally the same as single quotes 
 in that situation?

Why should they not?

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: Fix testsuite errors due to shell quoted parameter expansion issue.

2010-08-05 Thread Chet Ramey
On 8/3/10 4:55 PM, Eric Blake wrote:
 [adding autoconf to document some shell bugs]
 
 On 08/03/2010 02:32 PM, Ralf Wildenhues wrote:
 Interesting shell unportability:

 $ bash -c 'f= val e=; echo $e$f'
 val
 $ ksh -c 'f= val e=; echo $e$f'
  val

 ksh93, dash, zsh all do it like ksh.  Is that a bug in bash?
 
 Yes; adding bug-bash accordingly.  According to POSIX:

Thanks; this was an easy fix.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



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 marc.herb...@gmail.com 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 code if
I define them all as functions. I don't think functions are better than
aliases here. Any idea?

A='alias | grep ^alias .= | sed -e s/^alias // | LC_ALL=C command grep
^[a-zA-Z]'
B='builtin'
C='command'
D='date +%a %Y-%m-%d %H:%M:%S (%z %Z)'
E='export'
F='find'
G='git'
H='history'
I='ifconfig'
K='killall'
L='less'
M='LC_ALL=C man'
N='netstat'
O='openssl'
P='popd'
Q='[[ $WINDOW ]]  screen -X at '\''#'\'' stuff $'\''exit\n'\'''
R='route'
S='sudo'
T='touch'
U='uname'
V='echo $BASH_VERSION'
W='watch'
X='screen -X'
Y='yast2'
Z='reset'
a='alias'
b='builtin cd -'
c='clear'
d='dirs -v'
e='echo'
f='file'
g='grep'
h='help'
i='info --vi-keys'
j='jobs'
k='kill'
l='ls -l'
m='make'
n='mount'
p='pushd'
q='exit'
r='fc -s'
s='screen'
t='type'
u='umount'
v='vim'
w='w'
x='xargs'
y='yast'
z='echo ${COLUMNS}x$LINES'


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

2010-08-05 Thread Chris F.A. Johnson

On Fri, 6 Aug 2010, Clark J. Wang wrote:


On Thu, Aug 5, 2010 at 4:06 PM, Marc Herbert marc.herb...@gmail.com 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 code if

I define them all as functions.


This is much more code:

F(){ find $@; }

than:

alias F=find


I don't think functions are better than aliases here. Any idea?


Many reasons why functions are generally better have already been
given.

--
   Chris F.A. Johnson, http://cfajohnson.com
   Author:
   Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

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 ch...@cfajohnson.comwrote:

 On Fri, 6 Aug 2010, Clark J. Wang wrote:

  On Thu, Aug 5, 2010 at 4:06 PM, Marc Herbert marc.herb...@gmail.com
 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 code
 if

 I define them all as functions.


This is much more code:

 F(){ find $@; }

 This simple func definition will be 4 lines in my coding style. :) And I
like adding at least one blank line between functions.


than:

 alias F=find


  I don't think functions are better than aliases here. Any idea?


Many reasons why functions are generally better have already been
given.

 I understand functions are *generally* better and there're quite a lot of
functions defined in my bashrc.  I just don't agree we have to avoid using
aliases.

  --
   Chris F.A. Johnson, http://cfajohnson.com
   Author:
   Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)