On 8/19/11 6:38 AM, Roman Rakus wrote:
> On 08/18/2011 07:57 PM, Eric Blake wrote:
>> On 08/18/2011 08:53 AM, Roman Rakus wrote:
>>> On 08/18/2011 04:38 PM, Sam Steingold wrote:
how do I write a function that would print the same as
$ \ls | cat
>>> f3(){ printf "%s\n" "$@"; }
>>
>> "\n" l
On 08/18/2011 07:57 PM, Eric Blake wrote:
On 08/18/2011 08:53 AM, Roman Rakus wrote:
On 08/18/2011 04:38 PM, Sam Steingold wrote:
how do I write a function that would print the same as
$ \ls | cat
f3(){ printf "%s\n" "$@"; }
"\n" looks funny in shell; even though POSIX requires that "\n" doe
On 8/18/11 11:58 AM, Greg Wooledge wrote:
> It would appear "declare -g" does NOT allow you to "jump over" a local
> variable that is shadowing a global. That's disappointing.
That is not its intent. The very narrow purpose of declare -g is to
allow you to declare a variable with attributes in
On 08/18/2011 08:53 AM, Roman Rakus wrote:
On 08/18/2011 04:38 PM, Sam Steingold wrote:
how do I write a function that would print the same as
$ \ls | cat
f3(){ printf "%s\n" "$@"; }
"\n" looks funny in shell; even though POSIX requires that "\n" does not
treat the \ as an escape but as a li
On 08/18/2011 11:38 AM, Stefano Lattarini wrote:
Hi Eric.
On Thursday 18 August 2011, Eric Blake wrote:
On 08/18/2011 08:44 AM, Eric Blake wrote:
how do I write a function that would print the same as
$ \ls | cat
Useless use of cat. This can be done with \ls -1.
f(){ for a in "$@"; do ech
On Thursday 18 August 2011, Stefano Lattarini wrote:
> Hi Eric.
>
> On Thursday 18 August 2011, Eric Blake wrote:
> > On 08/18/2011 08:44 AM, Eric Blake wrote:
> > >> how do I write a function that would print the same as
> > >> $ \ls | cat
> >
> > Useless use of cat. This can be done with \ls -
Hi Eric.
On Thursday 18 August 2011, Eric Blake wrote:
> On 08/18/2011 08:44 AM, Eric Blake wrote:
> >> how do I write a function that would print the same as
> >> $ \ls | cat
>
> Useless use of cat. This can be done with \ls -1.
>
> > f(){ for a in "$@"; do echo "$a"; done; }
>
> Or skip the
` Greg Wooledge wrote:
On Thu, Aug 18, 2011 at 08:03:41AM -0700, Linda Walsh wrote:
4.2 introduce a new -g to declare a global variable inside a function.
Which doesn't say what it would do in situations like the above.
Then let's test:
imadev:~$ echo $BASH_VERSION
On Thu, Aug 18, 2011 at 08:03:41AM -0700, Linda Walsh wrote:
> >4.2 introduce a new -g to declare a global variable inside a function.
>
>Which doesn't say what it would do in situations like the above.
Then let's test:
imadev:~$ echo $BASH_VERSION
4.2.10(7)-release
imadev:~$ unset a b;
Pierre Gaston wrote:
Is this a question? or are you trying to make a point?
It is both -- a chance to find answer to a question, or make
the point that aliases in scripts have a useful purposes that
can't be replaced by function clls.
For the question (If I understand correctly):
1) Most
On 08/18/2011 04:38 PM, Sam Steingold wrote:
how do I write a function that would print the same as
$ \ls | cat
f3(){ printf "%s\n" "$@"; }
But please move your question like "HOW TO..." somewhere else;
comp.unix.shell usenet group or the #bash IRC channel on freenode or...
This mailing list
On 08/18/2011 08:44 AM, Eric Blake wrote:
how do I write a function that would print the same as
$ \ls | cat
Useless use of cat. This can be done with \ls -1.
f(){ for a in "$@"; do echo "$a"; done; }
Or skip the loop altogether:
f(){ printf %s\\n "%@"; }
--
Eric Blake ebl...@redhat.co
On 08/18/2011 08:38 AM, Sam Steingold wrote:
mkdir z
cd z
touch a b 'c d'
When doing exercises like this, I like to:
touch a b 'c d'
Notice the double spacing - it proves whether I used enough quoting
throughout the exercise - if 'c d' with one space shows up anywhere,
then I missed quotin
> * Eric Blake [2011-08-15 16:59:29 -0600]:
>
> On 08/15/2011 04:40 PM, Sam Steingold wrote:
>>> * Andreas Schwab [2011-08-15 22:04:04 +0200]:
>>>
>>> Sam Steingold writes:
>>>
Cool. Now, what does this imply?
>>>
>>> "For almost every purpose, shell functions are preferred over aliase
On Wed, Aug 17, 2011 at 08:46:34PM -0700, Linda Walsh wrote:
> how do you declare a variable for storage in the context of the caller?
> (using a function)...
> ???
The *caller* declares it.
> I found it very troublesome
> inside a function, to store a value into a local variable in the caller.
On Thu, Aug 18, 2011 at 6:46 AM, Linda Walsh wrote:
>
>
>
> ` Eric Blake wrote:
>>
>> On 08/15/2011 04:40 PM, Sam Steingold wrote:
* Andreas Schwab [2011-08-15 22:04:04 +0200]:
Sam Steingold writes:
>
> Cool. Now, what does this imply?
"For almost every purpo
` Eric Blake wrote:
On 08/15/2011 04:40 PM, Sam Steingold wrote:
* Andreas Schwab [2011-08-15 22:04:04 +0200]:
Sam Steingold writes:
Cool. Now, what does this imply?
"For almost every purpose, shell functions are preferred over
aliases."
so, how do I write
alias a=b
as a function?
(
On 08/15/2011 04:40 PM, Sam Steingold wrote:
* Andreas Schwab [2011-08-15 22:04:04 +0200]:
Sam Steingold writes:
Cool. Now, what does this imply?
"For almost every purpose, shell functions are preferred over aliases."
so, how do I write
alias a=b
as a function?
(remember that argu
> * Andreas Schwab [2011-08-15 22:04:04 +0200]:
>
> Sam Steingold writes:
>
>> Cool. Now, what does this imply?
>
>"For almost every purpose, shell functions are preferred over aliases."
so, how do I write
alias a=b
as a function?
(remember that arguments may contain spaces &c)
--
Sam S
Sam Steingold writes:
> Cool. Now, what does this imply?
"For almost every purpose, shell functions are preferred over aliases."
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 dif
On 08/15/2011 01:10 PM, Sam Steingold wrote:
* Andreas Schwab [2011-08-15 18:42:30 +0200]:
Sam Steingold writes:
this works:
$ alias z='echo a'
$ zz(){ z b; }
$ zz
a b
however, after sourcing this file:
if true; then
alias z='echo a'
zz(){ z b; }
fi
Aliases are expanded during read
> * Andreas Schwab [2011-08-15 18:42:30 +0200]:
>
> Sam Steingold writes:
>
>> this works:
>>
>> $ alias z='echo a'
>> $ zz(){ z b; }
>> $ zz
>> a b
>>
>> however, after sourcing this file:
>> if true; then
>> alias z='echo a'
>> zz(){ z b; }
>> fi
>
> Aliases are expanded during reading, but
Sam Steingold writes:
> this works:
>
> $ alias z='echo a'
> $ zz(){ z b; }
> $ zz
> a b
>
> however, after sourcing this file:
> if true; then
> alias z='echo a'
> zz(){ z b; }
> fi
Aliases are expanded during reading, but the alias command isn't
executed until after the complete compound c
23 matches
Mail list logo