It appears that `unset' is capable of traversing down the call-stack and
unsetting variables repeatedly:
a=0 b=0 c=0 d=0 e=0
_unset() { unset -v b c c d d d e; }
t1() {
local a=1 b=1 c=1 d=1
t2
}
t2() {
local a=2 b=2 c=2 d=2 e=2
_unset
ec
Binarus wrote:
> The script
>
> echo 'line1' > file
> echo 'line2' >> file
> RESULT=$(cat file)
> echo "$RESULT"
>
> gives the following output:
>
> line1
> line2
>
> I don't understand why: the command substitution $(cat file) is not
> within double quotes, so word splitting should be applied
DennisW wrote:
> Mapfile would be that much more powerful if the callback function had
> access to the current line. Is there any chance this might be added in
> the future?
Can't answer directly on this, but it looks like the gateway between this
group and the mailing list hasn't worked for a l
Mapfile would be that much more powerful if the callback function had
access to the current line. Is there any chance this might be added in
the future?
Is the =~ operator supposed to recognize \n in patterns? Example:
$ a='abc
def'
$ if [[ $a =~ c\nd ]]; then echo ok; fi
The above produces no output (I've tried using \\n, \\\n too), while using a
literal newline works:
$ if [[ $a =~ c$'\n'd ]]; then echo ok; fi
ok
Is that expected behavior o
On Apr 2, 8:19 am, Javier Montoya wrote:
> On Mar 19, 6:04 pm, DennisW wrote:
>
>
>
>
>
> > On Mar 19, 6:50 am, Javier Montoya wrote:
>
> > > On Mar 19, 12:39 pm, Javier Montoya wrote:
>
> > > > Dear all,
>
> > > > I have a several directories with *.jpg images. The image files are
> > > > name
On Mar 19, 6:50 am, Javier Montoya wrote:
> On Mar 19, 12:39 pm, Javier Montoya wrote:
>
>
>
>
>
> > Dear all,
>
> > I have a several directories with *.jpg images. The image files are
> > named as ascending numbers and I would like to retrieve the lowest and
> > largest image number in each dire
Javier Montoya wrote:
> Dear all,
>
> I have a several directories with *.jpg images. The image files are
> named as ascending numbers and I would like to retrieve the lowest and
> largest image number in each directory. An example of the content of a
> directory is given below:
> /bla/bla/bla/di
2010-03-11, 04:10(-08), Javier Montoya:
[...]
> I'm a newbie with bash programming and I'm trying to process a file
> into smaller
> chunks. Let's say I've to process the file below ('X' and 'Y' are any
> possible float number):
>
> 0 0 0 0 0 0
> 0 0 0 0 0 0
> X X X X X 1.70
> 0 0 0 0 0 0
> X X X X
Peng Yu wrote:
> My grep is aliased to "grep --color=auto".
>
> I then use grep "", where is a tab character. But the
> result is not colored. How to make the tabs colored?
GREP_COLORS='ms=07;31' grep ...
man grep, and wrong mailing list.
On Mar 7, 10:20 am, Peng Yu wrote:
> My grep is aliased to "grep --color=auto".
>
> I then use grep "", where is a tab character. But the
> result is not colored. How to make the tabs colored?
If you grep for a space or a newline, they don't get highlighted
either. That's just the way it works.
On Tue, May 4, 2010 at 10:28 AM, Dennis Williamson
wrote:
> for i in {28..55}
> # or: for ((i=28; i<=55; i++))
> do
> (( page = 148 - ( i - 28 ) * 2 ))
> printf '$d $03d\n' $i $page
> done
I assume that you mean '%d %03d'.
> This eliminates external calls to bc and seq in addition to zero-padd
On 05/04/2010 09:35 AM, Marc Herbert wrote:
> Are you are worried about the *cost* of the subshell? How can
> interactive completion be performance-sensitive?
Anything repetitive, done often enough, is observable even in an
interactive environment. The bash-completion library of functions does
a
Le 04/05/2010 14:40, Eric Blake a écrit :
> Except that in computing tab completion, side effects are _all_ that
> you want - basically, Freddie's problem is how to populate the
> global completion variables from within helper functions.
Of course you want a side-effect in the caller, and my examp
On 05/04/2010 03:11 AM, Marc Herbert wrote:
> I'd like to know why you absolutely want the callee to perform a
> side-effect on the caller. This is your original sin
> IMHO. Side-effects are evil, use as little of them as you can.
Except that in computing tab completion, side effects are _all_ tha
On Tue, May 04, 2010 at 08:05:47AM -0500, Peng Yu wrote:
> I want $page has three digits. If it is less than 100, prefix it with
> 0. Is there an easy way to do so in bash?
printf '%03d\n' $page
Hi,
I want $page has three digits. If it is less than 100, prefix it with
0. Is there an easy way to do so in bash?
for i in `seq 28 55`;
do
page=`echo '148-('$i'-28)*2'|bc`
echo $i $page
done
--
Regards,
Peng
Le 03/05/2010 20:25, Greg Wooledge a écrit :
> Use if/then/else/fi instead of && ||. Using && || is dangerous, as I've
> explained here:
>
> http://mywiki.wooledge.org/BashPitfalls#cmd1_.26.26_cmd2_.7C.7C_cmd3
Also note that using "&&" instead of "if" makes your script totally
incompatible with
Le 03/05/2010 21:08, Kunszt Árpád a écrit :
>> http://mywiki.wooledge.org/BashPitfalls#cmd1_.26.26_cmd2_.7C.7C_cmd3
> I read it, thanks. I understand it now.
>
> I read man bash lots of times, but this behavior had escaped my
> attention. There isn't any word about cmd1 && cmd2 || cmd3 only th
Le 01/05/2010 09:18, Freddy Vulto a écrit :
> I would like to call t(), and let it return me a filled variable by
> reference, that is without polluting the global environment.
I'd like to know why you absolutely want the callee to perform a
side-effect on the caller. This is your original sin
IM
20 matches
Mail list logo