<div dir="ltr">ti posso fare una domanda ?<div>Michele nel suo modo flugghista ti sta facendo capire che forse l'uso che fai del netcat</div><div>è alquanto strano..</div><div>come lo vuoi usare? </div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">Il giorno 29 dicembre 2017 09:40, Sandro Andreini <span dir="ltr"><<a href="mailto:sandro.andreini@libero.it" target="_blank">sandro.andreini@libero.it</a>></span> ha scritto:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div class="m_4293582768108928178moz-cite-prefix">Buongiorno a tutti.<br>
      Appena oggi ho un minuto faccio le prove da voi suggerite.<br>
      Grazie comunque del vostro aiuto.<span class="HOEnZb"><font color="#888888"><br>
      Sandro</font></span><div><div class="h5"><br>
      <br>
      Il 29/12/2017 07.29, alessio chemeri ha scritto:<br>
    </div></div></div><div><div class="h5">
    <blockquote type="cite">
      <div dir="ltr">scusa ma provare qualcosa del genere ?
        <div><br>
        </div>
        <div>
          <div>#!/bin/bash</div>
          <div>#cat ./comandi.txt</div>
          <div>for X in $(cat ./comandi.txt)</div>
          <div>do</div>
          <div>        netcat ipdelcaso portadelcaso $X</div>
          <div>done</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>che magari la pipe non ti serve?</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">Il giorno 29 dicembre 2017 01:00,
          Sandro Andreini <span dir="ltr"><<a href="mailto:sandro.andreini@libero.it" target="_blank">sandro.andreini@libero.it</a>></span>
          ha scritto:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF">
              <div class="m_4293582768108928178m_-4815683585162714348moz-cite-prefix">Non ho
                capito la tua risposta.....
                <div>
                  <div class="m_4293582768108928178h5"><br>
                    <br>
                    Il 29/12/2017 00.55, Michele Venturi ha scritto:<br>
                  </div>
                </div>
              </div>
              <div>
                <div class="m_4293582768108928178h5">
                  <blockquote type="cite">
                    <div>
                      <div dir="auto">Nel credere che non funzioni...</div>
                      <div dir="auto">In sostanza hai sbagliato tutto.</div>
                      <br>
                      <div class="gmail_quote">
                        <div>Il giorno ven 29 dic 2017 alle 00:48 Sandro
                          Andreini <<a href="mailto:sandro.andreini@libero.it" target="_blank">sandro.andreini@libero.it</a>>
                          ha scritto:<br>
                        </div>
                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                          <div text="#000000" bgcolor="#FFFFFF">
                            <div class="m_4293582768108928178m_-4815683585162714348m_5121640027718875978moz-cite-prefix">Ho
                              reso eseguibile lo script ma ancora non
                              va.<br>
                              Sia lo script che il file txt con dentro i
                              comandi sono nella cartella home
                              dell'utente.<br>
                              Lo sript gira perchè ho messo come prima
                              riga un echo che appare correttamente.<br>
                              Anche un singolo comando cat mi da la
                              corretta lettura.<br>
                              Pertanto direi che il risultato di cat non
                              viene correttamente passato a netcat.<br>
                              Quello che segue è lo script intero.<br>
                              <img alt=""><br>
                              Il comando echo e il comando cat
                              funzionano correttamente.<br>
                              L'ultimo sembra non funzionare.<br>
                              Se invece il solito comando lo do da shell
                              funziona.<br>
                              <img alt=""><br>
                              Dove sto sbagliando ?<br>
                              Grazie per il vostro aiuto.</div>
                          </div>
                          <div text="#000000" bgcolor="#FFFFFF">
                            <div class="m_4293582768108928178m_-4815683585162714348m_5121640027718875978moz-cite-prefix"><br>
                              Sandro</div>
                          </div>
                          <div text="#000000" bgcolor="#FFFFFF">
                            <div class="m_4293582768108928178m_-4815683585162714348m_5121640027718875978moz-cite-prefix"><br>
                              <br>
                              <br>
                              Il 28/12/2017 20.59, Michele Venturi ha
                              scritto:<br>
                            </div>
                          </div>
                          <div text="#000000" bgcolor="#FFFFFF">
                            <blockquote type="cite">
                              <div>
                                <div dir="auto">Hai fatto dei progressi?</div>
                                <div dir="auto">Che ci sei ancora o no?</div>
                                <br>
                                <div class="gmail_quote">
                                  <div>Il giorno gio 28 dic 2017 alle
                                    20:04 fran <<a href="mailto:francesco@wikicosi.it" target="_blank">francesco@wikicosi.it</a>>
                                    ha scritto:<br>
                                  </div>
                                  <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
                                    <br>
                                    <br>
                                    l'hai reso eseguibile ?<br>
                                    ls -la nome-script<br>
                                    <br>
                                    <br>
                                    <br>
                                     Thu, Dec 28, 2017 at 07:17:14PM
                                    +0100, Sandro Andreini ha scritto:<br>
                                    > Niente di così
                                    trascendentale......<br>
                                    > Semplicemente devo mandare un
                                    comando ad una scheda rele via tcp<br>
                                    > Questo comando fa chiudere il
                                    rele per 1 secondo e poi lo
                                    riapre.....<br>
                                    > Ho provato a creare lo script
                                    come suggerito da Alessio ma sembra
                                    non<br>
                                    > funzionare.<br>
                                    > Sicuramente sto sbagliando
                                    qualcosa perchè in relatà quando do
                                    il comando<br>
                                    > ./nomescript.sh sembra faccia
                                    qualcosa ma il rele non si attiva.<br>
                                    > Ora verifico.<br>
                                    > Per il momento grazie a tutti.<br>
                                    > Sandro<br>
                                    > Il 28/12/2017 18.59, alessio
                                    chemeri ha scritto:<br>
                                    > >qualcosa ho capito,<br>
                                    > >anche se non ho capito cosa
                                    hai nel file comandi.txt<br>
                                    > ><br>
                                    > >detto questo, fare uno
                                    script in sh non è cosi' complicato,
                                    o meglio non è<br>
                                    > >complicato fare quelli
                                    semplici come sembrerebbe il tuo.<br>
                                    > ><br>
                                    > >io ti consiglio di dare un
                                    occhiata alla roba che ha scritto il
                                    piccardi<br>
                                    > ><a href="http://gapil.gnulinux.it/download/" rel="noreferrer" target="_blank">http://gapil.gnulinux.it/down<wbr>load/</a><br>
                                    > ><br>
                                    > >è un po' anzianotto (il
                                    piccardi eheheh) ma a mio parere (e
                                    non conto un<br>
                                    > >cazzaccio nulla) è
                                    un'ottima lettura.<br>
                                    > ><br>
                                    > ><br>
                                    > >altrimenti..<br>
                                    > ><br>
                                    > >vi scriptone.sh<br>
                                    > ><br>
                                    > ><br>
                                    > >#!/bin/sh<br>
                                    > >#Questo è uno scriptone<br>
                                    > ><br>
                                    > >cat
                                    path_to_comandi/comandi.txt   |
                                    netcat blablabla portablabla<br>
                                    > ><br>
                                    > ><br>
                                    > ><br>
                                    > ><br>
                                    > >lo rendi eseguibile...<br>
                                    > >provi..<br>
                                    > ><br>
                                    > ><br>
                                    > >Il 28 dicembre 2017 18:32,
                                    Sandro Andreini <<a href="mailto:sandro.andreini@libero.it" target="_blank">sandro.andreini@libero.it</a>><br>
                                    > >ha scritto:<br>
                                    > >>Ok scusate per il mio
                                    caos.<br>
                                    > >>Ho necessità di inviare
                                    ad una scheda dei comandi che sono
                                    dentro il file<br>
                                    > >>comandi.txt.<br>
                                    > >>Per inviare questi
                                    comandi devo usare la sintassi cat
                                    comandi.txt | netcat<br>
                                    > >>192.168.1.100 6722<br>
                                    > >>Se uso questo comando
                                    da shell funziona regolarmente.<br>
                                    > >>Dentro comandi.txt in
                                    realtà non c'è niente altro che: 11*<br>
                                    > >>A questo punto ho
                                    bisogno di creare un file .sh che
                                    posso richiamare da<br>
                                    > >>Domoticz che è un
                                    server di domotica.<br>
                                    > >>Spero di essere stato
                                    più chiaro.<br>
                                    > >>Grazie a tutti.<br>
                                    > >>Sandro<br>
                                    > >><br>
                                    > >><br>
                                    > >>Il 28/12/2017 18.14,
                                    Michele Venturi ha scritto:<br>
                                    > >><br>
                                    > >>Spiegati meglio; ci
                                    servono il contesto ed i dettagli...<br>
                                    > >><br>
                                    > >>Il giorno gio 28 dic
                                    2017 alle 18:04 alessio chemeri<br>
                                    > >><<a href="mailto:alessio.chemeri@gmail.com" target="_blank">alessio.chemeri@gmail.com</a>>
                                    ha scritto:<br>
                                    > >>>mi accodo a peter,<br>
                                    > >>>non sei stato molto
                                    chiaro nella richiesta.<br>
                                    > >>><br>
                                    > >>>Se hai il file
                                    cmandi.txt puoi passarlo come
                                    parametro e trattarlo<br>
                                    > >>>come tale nello
                                    script interno, ma<br>
                                    > >>>devi dare il
                                    percorso (path) completo.<br>
                                    > >>><br>
                                    > >>><br>
                                    > >>>Il 28 dicembre 2017
                                    17:29, peterpunk <<a href="mailto:peterpunk@hackbloc.it" target="_blank">peterpunk@hackbloc.it</a>>
                                    ha scritto:<br>
                                    > >>>>On Thu, 28 Dec
                                    2017 16:08:17 +0100 Sandro wrote:<br>
                                    > >>>><br>
                                    > >>>>>Salve a
                                    tutti e a tutti auguri di buone
                                    feste.<br>
                                    > >>>>>Mi rivolgo
                                    a voi per chiedere lumi su una cosa
                                    per voi sicuramente<br>
                                    > >>>>>banale. Ho
                                    necessità di creare uno script nel
                                    quale devo inserire<br>
                                    > >>>>>i seguenti
                                    comandi che da shell funzionano
                                    correttamente.<br>
                                    > >>>>><br>
                                    > >>>>>cat
                                    comandi.txt | netcat 192.168.1.100
                                    6722<br>
                                    > >>>>><br>
                                    > >>>>>Ovviamente
                                    è presente un file denominato
                                    comandi.txt ma non ho<br>
                                    > >>>>>idea di
                                    come inserire questi comandi in uno
                                    scrpt sh.<br>
                                    > >>>>><br>
                                    > >>>>Io... Non ho
                                    capito bene la domanda :-(<br>
                                    > >>>>Vuoi inserire
                                    nello script i comandi elencati (a
                                    modino) nel file<br>
                                    > >>>>`comandi.txt'?<br>
                                    > >>>><br>
                                    > >>>>. comandi.txt<br>
                                    > >>>><br>
                                    > >>>>Il punto
                                    iniziale indica a bash di acquisire
                                    il contenuto del file di<br>
                                    > >>>>testo
                                    specificato dopo lo spazio; se
                                    quest'ultimo non risiede nella<br>
                                    > >>>>medesima
                                    directory dello script, allora
                                    dovrai specificare anche il<br>
                                    > >>>>percorso per
                                    raggiungerlo.<br>
                                    > >>>>--<br>
                                    > >>>><br>
                                    > >>>>  ,= ,-_-. =.<br>
                                    > >>>>((_/)o o(\_))<br>
                                    > >>>>  `-'(. .)`-'<br>
                                    > >>>>      \_/   
                                     printf("Mai un giorno senza una
                                    riga\n");<br>
                                    >
                                    >>>>__________________________<wbr>_____________________<br>
                                    > >>>>flug mailing
                                    list<br>
                                    > >>>><a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
                                    > >>>><a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/lis<wbr>tinfo/flug</a><br>
                                    >
                                    >>>___________________________<wbr>____________________<br>
                                    > >>>flug mailing list<br>
                                    > >>><a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
                                    > >>><a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/list<wbr>info/flug</a><br>
                                    > >>--<br>
                                    > >>--<br>
                                    > >><a href="http://profiles.google.com/dardo82" rel="noreferrer" target="_blank">http://profiles.google.com/d<wbr>ardo82</a><br>
                                    > >><br>
                                    > >><br>
                                    > >><br>
                                    >
                                    >>____________________________<wbr>___________________<br>
                                    > >>flug mailing list<br>
                                    > >><a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
                                    > >><a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/listi<wbr>nfo/flug</a><br>
                                    > >><br>
                                    > >><br>
                                    > >><br>
                                    >
                                    >>____________________________<wbr>___________________<br>
                                    > >>flug mailing list<br>
                                    > >><a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
                                    > >><a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/listi<wbr>nfo/flug</a><br>
                                    >
                                    >_____________________________<wbr>__________________<br>
                                    > >flug mailing list<br>
                                    > ><a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
                                    > ><a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/listin<wbr>fo/flug</a><br>
                                    ><br>
                                    ><br>
                                    > ______________________________<wbr>_________________<br>
                                    > flug mailing list<br>
                                    > <a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
                                    > <a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/listinf<wbr>o/flug</a><br>
                                    <br>
                                    --<br>
                                    Francesco<br>
                                    Key ID 90675501<br>
                                    L'orizzonte del FLUG è temporale:<br>
                                    inserito nel "luogo" che intercorre
                                    da un pasto al successivo....<br>
                                    oppure dal primo fiasco a quello
                                    dopo.....<br>
                                    ______________________________<wbr>_________________<br>
                                    flug mailing list<br>
                                    <a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
                                    <a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/listinf<wbr>o/flug</a></blockquote>
                                </div>
                              </div>
                              <div>-- <br>
                              </div>
                              <div class="m_4293582768108928178m_-4815683585162714348m_5121640027718875978gmail_signature" data-smartmail="gmail_signature">
                                <div>
                                  <div>--</div>
                                  <a href="http://profiles.google.com/dardo82" target="_blank">http://profiles.google.com/dar<wbr>do82</a>
                                  <div><br>
                                  </div>
                                </div>
                              </div>
                              <br>
                              <fieldset class="m_4293582768108928178m_-4815683585162714348m_5121640027718875978mimeAttachmentHeader"></fieldset>
                              <br>
                              <pre>______________________________<wbr>_________________
flug mailing list
<a class="m_4293582768108928178m_-4815683585162714348m_5121640027718875978moz-txt-link-abbreviated" href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a>
<a class="m_4293582768108928178m_-4815683585162714348m_5121640027718875978moz-txt-link-freetext" href="https://lists.linux.it/listinfo/flug" target="_blank">https://lists.linux.it/listinf<wbr>o/flug</a></pre>
                            </blockquote>
                            <p><br>
                            </p>
                          </div>
                          ______________________________<wbr>_________________<br>
                          flug mailing list<br>
                          <a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
                          <a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/listinf<wbr>o/flug</a></blockquote>
                      </div>
                    </div>
                    <div dir="ltr">-- <br>
                    </div>
                    <div class="m_4293582768108928178m_-4815683585162714348gmail_signature" data-smartmail="gmail_signature">
                      <div dir="ltr">
                        <div>--</div>
                        <a href="http://profiles.google.com/dardo82" target="_blank">http://profiles.google.com/dar<wbr>do82</a>
                        <div><br>
                        </div>
                      </div>
                    </div>
                    <br>
                    <fieldset class="m_4293582768108928178m_-4815683585162714348mimeAttachmentHeader"></fieldset>
                    <br>
                    <pre>______________________________<wbr>_________________
flug mailing list
<a class="m_4293582768108928178m_-4815683585162714348moz-txt-link-abbreviated" href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a>
<a class="m_4293582768108928178m_-4815683585162714348moz-txt-link-freetext" href="https://lists.linux.it/listinfo/flug" target="_blank">https://lists.linux.it/listinf<wbr>o/flug</a></pre>
                  </blockquote>
                  <p><br>
                  </p>
                </div>
              </div>
            </div>
            <br>
            ______________________________<wbr>_________________<br>
            flug mailing list<br>
            <a href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a><br>
            <a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/listinf<wbr>o/flug</a><br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="m_4293582768108928178mimeAttachmentHeader"></fieldset>
      <br>
      <pre>______________________________<wbr>_________________
flug mailing list
<a class="m_4293582768108928178moz-txt-link-abbreviated" href="mailto:flug@lists.linux.it" target="_blank">flug@lists.linux.it</a>
<a class="m_4293582768108928178moz-txt-link-freetext" href="https://lists.linux.it/listinfo/flug" target="_blank">https://lists.linux.it/<wbr>listinfo/flug</a></pre>
    </blockquote>
    <p><br>
    </p>
  </div></div></div>

<br>______________________________<wbr>_________________<br>
flug mailing list<br>
<a href="mailto:flug@lists.linux.it">flug@lists.linux.it</a><br>
<a href="https://lists.linux.it/listinfo/flug" rel="noreferrer" target="_blank">https://lists.linux.it/<wbr>listinfo/flug</a><br></blockquote></div><br></div>