language-experts
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[language-experts] bash --version 4.4.12(1)


From: étienne
Subject: [language-experts] bash --version 4.4.12(1)
Date: Tue, 17 Oct 2017 07:44:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512



Hello Team,

First of all, thank you for all you do. Indeed!

I drop you this email because I noted something on bash version 4.4.12(1),
In advance i'm sorry if it is not relevant, or if it is not the
appropriate email address.

It does raise the following error that it does not in version 4.3.* (and
previous) and it was very pleasant with bash, not to be "warned" each
time in such a case, as we can be with python for example.

In bash, in a function (the one i'm talking about will be insert in a
loop), the builtin 'continue' (and 'break') raised no error (even if it
was declared alone, I mean out of a loop) and as I understand it, it was
an important difference of structure between bash and OOP languages,
important and practical.

Today I ran my script on my Archlinux and for a second I wondered if my
.sh was a .py ?  : )


[ address@hidden:~/GIT/totoloto ]# uname -a
Linux resonance 4.13.5-1-ARCH #1 SMP PREEMPT Fri Oct 6 09:58:47 CEST
2017 x86_64 GNU/Linux
[ address@hidden:~/GIT/totoloto ]#

[ address@hidden:~/GIT/totoloto ]# !ba
bash --version
GNU bash, version 4.4.12(1)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[ address@hidden:~/GIT/totoloto ]#

[ address@hidden:~/GIT/totoloto ]# ./loto.sh

 Boule 1 :    41
./loto.sh: ligne 9 : continue: ceci n'a un sens que dans une boucle «
for », « while » ou « until »
 Boule 2 :    4
 Boule 3 :    28
 Boule 4 :    42
 Boule 5 :    44
Complémentaire : 8

[ address@hidden:~/GIT/totoloto ]#
[ address@hidden:~/GIT/totoloto ]# export LANG=C
[ address@hidden:~/GIT/totoloto ]# ./loto.sh

 Boule 1 :    34
./loto.sh: ligne 9 : continue: only meaningful in a `for', `while', or
`until' loop
 Boule 2 :    34        # see the script below, you will see the "issue"
 Boule 3 :    38
./loto.sh: ligne 9 : continue: only meaningful in a `for', `while', or
`until' loop
 Boule 4 :    8          # why not 38 here too ?
./loto.sh: ligne 9 : continue: only meaningful in a `for', `while', or
`until' loop
 Boule 5 :    4
Complémentaire : 4

[ address@hidden:~/GIT/totoloto ]#


The error raise only when the function is called.

On all my other systems (which run bash version 4.3.* and previous), no
error (even if the function is called) :

address@hidden:/home/blue/GIT/totoloto-# uname -a
Linux saturn 4.13.5-100.fc25.x86_64 #1 SMP Fri Oct 6 01:01:44 UTC 2017
x86_64 x86_64 x86_64 GNU/Linux
address@hidden:/home/blue/GIT/totoloto-# !ba
bash --version
GNU bash, version 4.3.43(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
Licence GPLv3+ : GNU GPL version 3 ou ultérieure
<http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
address@hidden:/home/blue/GIT/totoloto-#

address@hidden:/home/blue/GIT/totoloto-# ./loto.sh

 Boule 1 :    30
 Boule 2 :    42
 Boule 3 :    46
 Boule 4 :    21
 Boule 5 :    48
Complémentaire : 2

address@hidden:/home/blue/GIT/totoloto-#


Here is my script :

https://github.com/ceruleanfirm/totoloto


address@hidden:~/GIT/totoloto-$ cat loto.sh
#!/bin/bash
# loto.sh
# randomisation d'une grille

touch loto

Suspense () {  
# si identique à une déjà sortie, on recommence
    grep -q $res $1 && continue    # 2>/dev/null   # this redirection is
sufficient to solve the "issue"
    echo $res >> $1
}

chance=1
int=2
echo
sleep 1

while [ $chance -le 5 ]
do
    while true
    do
        nb=$((RANDOM-1))
        res=$(($nb/$int))
        [[ $res -le 49 && $res -ge 1 ]] && break
        ((int++))
    done
    Suspense loto
    echo -e " Boule $chance :\t$res"
    sleep 1
    ((chance++))
done
sleep 1
cpl=1
int=2

while true
do
    nb=$((RANDOM+1))
    res=$(($nb*$int%$$))
    [[ $res -le 10 && $res -ge 1 ]] && break
    ((int++))
done
echo "Complémentaire : $res"
sleep 1
rm loto
echo

exit 0



# Écrit par cerulean  <address@hidden>  0x71F86DC1B12845E9
# Mars 2016
# Free For All

address@hidden:~/GIT/totoloto-$



I know you have much more to do, and that it could be an Archlinux
issue, but in the case it could help ...

Kind regards, and again, THANKS for all.


Étienne Demercastel

Autodidact

Linux, Bash and Python enthousiastic


PS : sorry for my poor english ...

-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJZ5ZiwAAoJEKrYW/eAWbSdlCAQAIqD4pzpecyyXMHjTsVfMD0f
s+PeB2umIpqLLD9P+cefM5qLFrIiWE6q7z/jvUI7Y3TeOUrmrfkv3NF9jYhvKbo1
pdNeYJNQM+trIrcDHbEHL8QIW1ZMoyjDiFmwo+i3JLqKYhBmBoYQ8e+sRfghIQv2
PNIYsG4ipSrIr7tREYZBAVyc5QM3qs4jluomH+gqzwEWWwRe8yzjzhRn4vnyFMW9
q0bIapHf6hVdOoZUd4KPaxEaGByd+FBiQBV4NlVVesA5QyHmXJQNNGIPqd4DByzR
1XAtEjod1k4mMJ3btR2v3mpbITcR7EuKPNKVpvMm2i/vEBUJK+Omj8xnhlC8/VFP
sLXgQxvMPdt1XMduZvJqWxy0hKpy7ovpB4TM+MPFTlTw9mpHDTCGEqcv6OTj4aRt
fJnRQpmQtoH7z7rdk8ZzrtWl9i9fS8CQBWJTnWgQvGZs+AOo0qUh7afMSmtyMc2n
rpn1Ejh4ioQ6HNZt2ZuqUzCAA7tqi4LnIy4K1wqbDsLKIEoM9b7h7t8Ggeb+k+Yq
n0ThuLVox56avHemGTMzTmJVE0u7d19V/Bsl02piJIaBliSfYSnxJSRniyFZd+fx
jWKFCEA+vCZ1EkKbDcCUdbdI93z1zM5AZYnco1Jegb5lqvbQWS3cU5zITuo0LJ+L
1pP1rdTHSme/ZWvG3SNx
=kqyk
-----END PGP SIGNATURE-----

Attachment: 0x8059B49D.asc
Description: application/pgp-keys

Attachment: 0x8059B49D.asc.sig
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]