OVH Cloud OVH Cloud

[HS] - Ajouter une virgule

4 réponses
Avatar
David Martin
--000000000000297b57056bc050ac
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Salut,

Je me retrouve devant un probl=C3=A8me tout b=C3=AAte... comment dans la r=
=C3=A9cup=C3=A9ration
d'un entier... on ajoute une virgule ? (enfin j'aimerai ajouter un point
plutot)

echo $MAVARIABLE
3456

je souhaiterai :
345.6

je ne trouve pas ;-(

Une =C3=A2me charitable ;-)

--=20
david martin

--000000000000297b57056bc050ac
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div><div>Salut,<br><br></div>Je me retrouve devant u=
n probl=C3=A8me tout b=C3=AAte... comment dans la r=C3=A9cup=C3=A9ration<br=
></div>d&#39;un entier... on ajoute une virgule ? (enfin j&#39;aimerai ajou=
ter un point plutot)<br><br></div>echo $MAVARIABLE<br><div>3456<br><br></di=
v><div>je souhaiterai : <br>345.6<br><br></div><div>je ne trouve pas ;-(<br=
><br></div><div>Une =C3=A2me charitable ;-)<br clear=3D"all"></div><div><di=
v><div><div><div><div><br>-- <br><div class=3D"gmail_signature" data-smartm=
ail=3D"gmail_signature"><div dir=3D"ltr">david martin<div><br></div></div><=
/div>
</div></div></div></div></div></div></div>

--000000000000297b57056bc050ac--

4 réponses

Avatar
This is a multipart message in MIME format.
------=_NextPart_000_0027_01D3E77A.E136D5D0
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Et encore mieux : http://www.basicallytech.com/blog/archive/23/command-line-calculations-us ing-bc/
Sorry pour le double post.
Clément VANDENDAELEN
Web : <http://www.vandendaelen.com/> www.vandendaelen.com
De : David Martin
Envoyé : mercredi 9 mai 2018 08:50
À : French
Objet : [HS] - Ajouter une virgule
Salut,
Je me retrouve devant un problème tout bête... comment dans la récupération
d'un entier... on ajoute une virgule ? (enfin j'aimerai ajouter un point plutot)
echo $MAVARIABLE
3456
je souhaiterai :
345.6
je ne trouve pas ;-(
Une âme charitable ;-)
--
david martin
------=_NextPart_000_0027_01D3E77A.E136D5D0
Content-Type: text/html;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Calibri Light";
panose-1:2 15 3 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=FR-BE link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Et encore mieux&nbsp;: <a href="http://www.basicallytech.com/blog/archive/23/command-line-calcula tions-using-bc/">http://www.basicallytech.com/blog/archive/23/command-lin e-calculations-using-bc/</a><o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Sorry pour le double post.<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><b><span lang=FR style='font-size:12.0pt;font-family:"Calibri Light",sans-serif;color:#2F5496'>Clément VANDENDAELEN<o:p></o:p></span></b></p><p class=MsoNormal><span lang=FR style='font-size:12.0pt;font-family:"Calibri Light",sans-serif'>Web : <a href="http://www.vandendaelen.com/"><span style='color:blue'>www.vandendaelen.com</span></a><o:p></o:p></span></p ><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><b><span lang=FR>De&nbsp;:</span></b><span lang=FR> David Martin &lt;&gt; <br><b>Envoyé&nbsp;:</b> mercredi 9 mai 2018 08:50<br><b>À&nbsp;:</b> French &lt;&gt;<br><b>Objet&nbsp;:</b> [HS] - Ajouter une virgule<o:p></o:p></span></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><div><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>Salut,<o:p></o:p></p></div><p class=MsoNormal>Je me retrouve devant un problème tout bête... comment dans la récupération<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>d'un entier... on ajoute une virgule ? (enfin j'aimerai ajouter un point plutot)<o:p></o:p></p></div><p class=MsoNormal>echo $MAVARIABLE<o:p></o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'>3456<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'>je souhaiterai : <br>345.6<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'>je ne trouve pas ;-(<o:p></o:p></p></div><div><p class=MsoNormal>Une âme charitable ;-)<br clear=all><o:p></o:p></p></div><div><div><div><div><div><div><p class=MsoNormal><br>-- <o:p></o:p></p><div><div><p class=MsoNormal>david martin<o:p></o:p></p><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></div></div></div></div></di v></div></div></div></div></div></body></html>
------=_NextPart_000_0027_01D3E77A.E136D5D0--
Avatar
This is a multipart message in MIME format.
------=_NextPart_000_001F_01D3E77A.84FEE500
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Hello !
Je ne suis pas un expert en bash, mais ce lien t’aidera sans doute. : https://www.linuxquestions.org/questions/programming-9/bash-scripting-con verting-integer-to-decimal-905791/
Clément VANDENDAELEN
Web : <http://www.vandendaelen.com/> www.vandendaelen.com
De : David Martin
Envoyé : mercredi 9 mai 2018 08:50
À : French
Objet : [HS] - Ajouter une virgule
Salut,
Je me retrouve devant un problème tout bête... comment dans la récupération
d'un entier... on ajoute une virgule ? (enfin j'aimerai ajouter un point plutot)
echo $MAVARIABLE
3456
je souhaiterai :
345.6
je ne trouve pas ;-(
Une âme charitable ;-)
--
david martin
------=_NextPart_000_001F_01D3E77A.84FEE500
Content-Type: text/html;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Calibri Light";
panose-1:2 15 3 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=FR-BE link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Hello&nbsp;!<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Je ne suis pas un expert en bash, mais ce lien t’aidera sans doute.&nbsp;: <a href="https://www.linuxquestions.org/questions/programming-9/bash-scrip ting-converting-integer-to-decimal-905791/">https://www.linuxquestions.or g/questions/programming-9/bash-scripting-converting-integer-to-decimal-90 5791/</a><o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><b><span lang=FR style='font-size:12.0pt;font-family:"Calibri Light",sans-serif;color:#2F5496'>Clément VANDENDAELEN<o:p></o:p></span></b></p><p class=MsoNormal><span lang=FR style='font-size:12.0pt;font-family:"Calibri Light",sans-serif'>Web : <a href="http://www.vandendaelen.com/"><span style='color:blue'>www.vandendaelen.com</span></a><o:p></o:p></span></p ><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><b><span lang=FR>De&nbsp;:</span></b><span lang=FR> David Martin &lt;&gt; <br><b>Envoyé&nbsp;:</b> mercredi 9 mai 2018 08:50<br><b>À&nbsp;:</b> French &lt;&gt;<br><b>Objet&nbsp;:</b> [HS] - Ajouter une virgule<o:p></o:p></span></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><div><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>Salut,<o:p></o:p></p></div><p class=MsoNormal>Je me retrouve devant un problème tout bête... comment dans la récupération<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>d'un entier... on ajoute une virgule ? (enfin j'aimerai ajouter un point plutot)<o:p></o:p></p></div><p class=MsoNormal>echo $MAVARIABLE<o:p></o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'>3456<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'>je souhaiterai : <br>345.6<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'>je ne trouve pas ;-(<o:p></o:p></p></div><div><p class=MsoNormal>Une âme charitable ;-)<br clear=all><o:p></o:p></p></div><div><div><div><div><div><div><p class=MsoNormal><br>-- <o:p></o:p></p><div><div><p class=MsoNormal>david martin<o:p></o:p></p><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></div></div></div></div></di v></div></div></div></div></div></body></html>
------=_NextPart_000_001F_01D3E77A.84FEE500--
Avatar
Jean-Marc
--Signature=_Wed__9_May_2018_11_46_57_+0200_/ctXjGZQJibtp7U2
Content-Type: text/plain; charset=UTF-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Wed, 9 May 2018 08:50:05 +0200
David Martin écrivait :
Salut,
Je me retrouve devant un problème tout bête... comment dans la récupération
d'un entier... on ajoute une virgule ? (enfin j'aimerai ajouter un point
plutot)
echo $MAVARIABLE
3456
je souhaiterai :
345.6
je ne trouve pas ;-(
Une âme charitable ;-)

Style, comme ça ?
$ MAVARIABLE456
$ echo "scale=1; $MAVARIABLE/10" | bc
345.6
--
david martin

Jean-Marc
--Signature=_Wed__9_May_2018_11_46_57_+0200_/ctXjGZQJibtp7U2
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEEWjgcRC0dCXkfm9hQHHLXC3pxPwFAlryw5EACgkQQHHLXC3p
xPyBiw/+JNmpa0RhJ015Il0ks/RQ4RP+QntdJ8BLMs47QQvqEm2uBG6nKGcJ+47f
t9cPB1ctvRfIaUeUfw5RdjSE9OTItZfMyzeGjwB6MdBye8VO0HIPCF2MUhX6fZFF
nZpKyHcoYiVNgAmAM0g7UrlBCq6+rKYrvcnAZFVU/i0NxBXmIEgBHKn09hX1g2h/
n1y3tsFh98Bksbi+llBRBpymWMcrmRUqsyC4iFGoSOW6HBFzTGoF8WdBrH3VQv95
lN3oER2PT2fQvAK57LYngyCISfXjnFI1x4xRSMa+md8wi6gT64trMIkeYHD+r5qj
VrSyMf5xP7ky+/lcaQzTpMq4XMfTRqMUUZbqKTOQi9Gs2bajfhFWe6jwIR2QHE7M
HQ8GVxv4LzRMFh096kymczuivYp6x338RoC/FskvQNpUN973lG6QNi+79AleR1ft
BE/pfqMmco5sW4ENJogWikxEj+L9Kst4dnDo1p/2vikRcZQJ5xMKPQeLABRuqvg8
R4P8m4VcXl4OQ6h+WE4d5HiOPQm5SsA5zQArfBv7ODFcKe7MrzB6swBQGB63y11l
Cr0FnSfKUanJ7HouCngs+zruE+KXatRv4U6PiV1WP81+sOV88agUsdUTAbtk081I
xGSGvk2WwjBsZCvK1cMMVOpJVfujunQUMgj6Fdou9p7x5oVduvA =QDzY
-----END PGP SIGNATURE-----
--Signature=_Wed__9_May_2018_11_46_57_+0200_/ctXjGZQJibtp7U2--
Avatar
fab
'lut,
./gtech-volt: line 17: [: 274.8: integer expression expected

tu compares des chaines. Essaye un "=" à la place de ton "-eq" ?
f.