On 6/23/10 4:54 AM, Yves wrote:
> Description:
> I want to generate a "bash-proof" string by enclosing it in
> single quotes and managing enclosed single quotes. Basically, I
> would replace << word1 word'2 >> with << 'word1 word'"'"'2' >>.
> I can't find the syntax for
On 06/23/2010 07:01 PM, Andres P wrote:
> On Wed, Jun 23, 2010 at 8:23 PM, Peng Yu wrote:
>> Why printf is better than echo? Is this because printf is more robust than
>> echo?
>
> Because if a string that is to be printed happens to be an echo flag, such
> as -n or -e, there's no straight forwa
On Wed, Jun 23, 2010 at 8:23 PM, Peng Yu wrote:
> Why printf is better than echo? Is this because printf is more robust than
> echo?
Because if a string that is to be printed happens to be an echo flag, such
as -n or -e, there's no straight forward way of escaping it such as
with printf %s.
And
On Wed, Jun 23, 2010 at 5:43 PM, Chris F.A. Johnson
wrote:
> On Wed, 23 Jun 2010, Peng Yu wrote:
>
>> Hi,
>>
>> According to man bash, I thought that $@ instead of $* can help me
>> pass a string with space as a parameter. But it is not. Would you
>> please show me how to print 'b c' as a single a
On Wed, Jun 23, 2010 at 6:07 PM, Peng Yu wrote:
> #!/usr/bin/env bash
>
> function f {
> #for i in $*;
> for i in $@;
> do
> echo $i
> done
> }
>
You can also omit the variable intirely:
for i; do
echo "$i"
done
In that case, the for loop will iterate over "$@".
On Wed, 23 Jun 2010, Peng Yu wrote:
> Hi,
>
> According to man bash, I thought that $@ instead of $* can help me
> pass a string with space as a parameter. But it is not. Would you
> please show me how to print 'b c' as a single argument in the
> following code?
Always quote variable referenc
Hi,
According to man bash, I thought that $@ instead of $* can help me
pass a string with space as a parameter. But it is not. Would you
please show me how to print 'b c' as a single argument in the
following code?
#!/usr/bin/env bash
function f {
#for i in $*;
for i in $@;
do
echo $i
done
}
On Wed, Jun 23, 2010 at 03:27:28PM -0500, Peng Yu wrote:
> #for i in {0..${#parameter}};
This doesn't work. The parser does things in a very specific order.
Brace expansion is done before parameter expansion. The parser sees
0..$ and that isn't a legitimate brace expansion range, so it doesn't
p
On Wed, Jun 23, 2010 at 10:54:50AM +0200, Yves wrote:
> I want to generate a "bash-proof" string by enclosing it in
> single quotes and managing enclosed single quotes.
A better approach is to use:
printf -v new_string %q "$original_string"
printf %q is essentially the reverse of e
From: pub...@yeti.selfip.net
To: bug-bash@gnu.org
Configuration Information [Automatically generated, do not change]: FALSE!!!
Machine: i586
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i586'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i586-mandriva-linux-
The commented line in the following bash script is not working. I
notice the following description from man bash and I think that it is
the reason. But I'm not completely sure. Would you please confirm it
for me?
Also, I'm wondering where this decision was made. Can't bash be made
more powerful by
Chet Ramey wrote:
On 6/22/10 6:57 PM, Matthew Woehlke wrote:
No question something bad is going on here.
You're right. I found and fixed it. It wasn't where I was looking
initially. The fix will be in the next bash release and may come out
as a patch.
Also, when run under valgrind, I see
On Wed, Jun 23, 2010 at 10:00:12AM +0200, Werner Fink wrote:
> On Tue, Jun 22, 2010 at 04:50:54PM -0400, Chet Ramey wrote:
> > On 6/18/10 10:05 AM, Dr. Werner Fink wrote:
> >
> > > as now is visible the last command in the pipe sequence done
> > > in the bash is a real sub process whereas in the k
On Tue, Jun 22, 2010 at 04:50:54PM -0400, Chet Ramey wrote:
> On 6/18/10 10:05 AM, Dr. Werner Fink wrote:
>
> > as now is visible the last command in the pipe sequence done
> > in the bash is a real sub process whereas in the ksh it is not.
> >
> > The question rises: Why does the bash require a
14 matches
Mail list logo