UFFICIALE L'OT di Linux e altri OS

rebellion

Utente Èlite
1,593
506
CPU
intel i5 9500
Dissipatore
cooler master hyper 212 evo
Scheda Madre
asrock b360 pro4
HDD
samsung 850evo 250GB+samsung 840pro 128GB+seagate barracuda 2TB+seagate barracuda 2TB
RAM
corsair vengeance lpx ddr4 2133MHz 2x4GB CL13
GPU
integrata intel hd graphics 630
Audio
integrata
Monitor
samsung ue55mu6500u
PSU
xfx pro series 550w core edition
Case
mastercooler
OS
archlinux x64 + gnome3.34.1 && windows10 pro x64
@« MoMy » rivisto e corretto il database libreria, tipo se premevi il tasto elimina senza aver selezionato nessun record ti brasava l'intero database. adesso mi sembra definitivo:
Codice:
#!/bin/bash

## controllo dipendenze
if [ ! -e "/usr/bin/zenity" ] || [ ! -e "/usr/bin/gtkdialog" ] ; then dip=""
 if [ ! -e "/usr/bin/zenity" ] ; then dip=$dip" zenity" ; fi ; if [ ! -e "/usr/bin/gtkdialog" ] ; then dip=$dip" gtkdialog" ; fi
 zenity --error --width=500 --height=100 --text="Errore: dipendenze non soddisfatte, installa $dip. Applicazione terminata." ; if [ $? -eq 1 ] ; then gnome-terminal --geometry=35x6 --hide-menubar --title="ERRORE dipndenze" -e 'bash -c "echo "" ; echo --------------------------;echo installa: '$dip'; echo --------------------------; echo app terminata, premi invio..; read"' ; fi
 exit 0
fi

AGGIUNGI_LIBRO()
{
while [ "$sceltains" != "Cancel" ] && [ "$sceltains" != "abort" ]
do
 I=$IFS ; IFS=""
 for STATEMENTS in $(gtkdialog --program INSERIMENTO); do
  eval $STATEMENTS
 done
 IFS=$I
 if [ "$formato" = "" ]; then formato="brossura"; else formato=${formato##* }; fi
 sceltains=$EXIT
 if [ "$EXIT" = "OK" ] && ([ -n "$autore" ] && [ -n "$titolo" ])
 then
  if [ -z "$genere" ] ; then genere="-" ; fi ; if [ -z "$anno" ] ; then anno="-" ; fi ; if [ -z "$editore" ] ; then editore="-" ; fi ; if [ -z "$note" ] ; then note="-" ; fi
  if [ -e "$dir" ] ; then
   num=$(tail -1 "$dir" | awk -F "|" '{print$1}') ; lett=${num:0: -3} ; num=${num:1}
   if [ "$num" -eq 999 ] ; then num=0 ; lett=$(printf "%d\n" \'$lett) ; lett=$((lett+1)); lett=$(printf "\x$(printf %x $lett)") ; else num=$((num+1)) ; fi
  else
   num="a000"
  fi
  if [ "${#num}" = 1 ] ; then num=$lett"00"$num ; elif [ "${#num}" = 2 ] ; then num=$lett"0"$num ; else num=$lett$num ; fi
  titolo=$(echo $titolo) ; autore=$(echo $autore) ; genere=$(echo $genere) ; anno=$(echo $anno) ; editore=$(echo $editore) ; note=$(echo $note)
  titolo=${titolo//|/¦} ; autore=${autore//|/¦} ; genere=${genere//|/¦} ; anno=${anno//|/¦} ; editore=${editore//|/¦} ; note=${note//|/¦}
  echo $num"|"$titolo"|"$autore"|"$genere"|"$anno"|"$editore"|"$formato"|"$note >> "$dir"
 fi
done
}
FIND_BOOK()
{
if [[ -n "$TARGET_ITEM" ]] && [ "${#TARGET_ITEM}" -ge 3 ]; then
 if [ "$VAR_TITOLO" = true ] ; then
  LINEA_FIND_=`eval cat "$_DATA_BASE_" | awk 'BEGIN { FS="|" } {print NR, $2}' | grep -i "$TARGET_ITEM" | sed "s/ .*$//g"`
  _RESULT_PUBBL_=`for PRE_RESULT_ in $LINEA_FIND_; do sed -n ${PRE_RESULT_}p $_DATA_BASE_ ; done`
 elif [ "$VAR_AUTORE" = true ] ; then
  LINEA_FIND_=`eval cat "$_DATA_BASE_" | awk 'BEGIN { FS="|" } {print NR, $3}' | grep -i "$TARGET_ITEM" | sed "s/ .*$//g"`
  _RESULT_PUBBL_=`for PRE_RESULT_ in $LINEA_FIND_; do sed -n ${PRE_RESULT_}p $_DATA_BASE_ ; done`
 elif [ "$VAR_GENERE" = true ] ; then
  LINEA_FIND_=`eval cat "$_DATA_BASE_" | awk 'BEGIN { FS="|" } {print NR, $4}' | grep -i "$TARGET_ITEM" | sed "s/ .*$//g"`
  _RESULT_PUBBL_=`for PRE_RESULT_ in $LINEA_FIND_; do sed -n ${PRE_RESULT_}p $_DATA_BASE_ ; done`
 elif [ "$VAR_ANNO" = true ] ; then
  LINEA_FIND_=`eval cat "$_DATA_BASE_" | awk 'BEGIN { FS="|" } {print NR, $5}' | grep -i "$TARGET_ITEM" | sed "s/ .*$//g"`
  _RESULT_PUBBL_=`for PRE_RESULT_ in $LINEA_FIND_; do sed -n ${PRE_RESULT_}p $_DATA_BASE_ ; done`
 elif [ "$VAR_EDITORE" = true ] ; then
  LINEA_FIND_=`eval cat "$_DATA_BASE_" | awk 'BEGIN { FS="|" } {print NR, $6}' | grep -i "$TARGET_ITEM" | sed "s/ .*$//g"`
  _RESULT_PUBBL_=`for PRE_RESULT_ in $LINEA_FIND_; do sed -n ${PRE_RESULT_}p $_DATA_BASE_ ; done`
 elif [ "$VAR_FORMATO" = true ] ; then
  LINEA_FIND_=`eval cat "$_DATA_BASE_" | awk 'BEGIN { FS="|" } {print NR, $7}' | grep -i "$TARGET_ITEM" | sed "s/ .*$//g"`
  _RESULT_PUBBL_=`for PRE_RESULT_ in $LINEA_FIND_; do sed -n ${PRE_RESULT_}p $_DATA_BASE_ ; done`
 else
  _RESULT_PUBBL_=`cat "$_DATA_BASE_" | grep -i "$TARGET_ITEM"`
 fi
fi
echo "$_RESULT_PUBBL_"
}
CONFERMA_ELIMINA()
{
if [ -n "$CERCA" ] ; then var=$CERCA ; fi
if [ -n "$TABLE" ] ; then var=$TABLE ; fi
zenity --question --width=400 --height=100 --title="conferma eliminazione record $var"
if [ $? = 0 ] ; then
 sed -i "/^$var/d" "$dir"
 sed -i "/^$/d" "$dir"
fi
}
MODIFICA()
{
titolo=$(cat "$dir" | grep "$CERCA" | awk -F "|" '{print$2}')
autore=$(cat "$dir" | grep "$CERCA" | awk -F "|" '{print$3}')
genere=$(cat "$dir" | grep "$CERCA" | awk -F "|" '{print$4}')
anno=$(cat "$dir" | grep "$CERCA" | awk -F "|" '{print$5}')
editore=$(cat "$dir" | grep "$CERCA" | awk -F "|" '{print$6}')
formato=$(cat "$dir" | grep "$CERCA" | awk -F "|" '{print$7}')
note=$(cat "$dir" | grep "$CERCA" | awk -F "|" '{print$8}')
export MODIFICA='
<window title="Modifica record '"$CERCA"'">
<vbox>
<hbox>
 <frame Titolo>
  <entry max_length="25">
   <default>'"$titolo"'</default>
   <variable>tit</variable>
   <width>300</width><height>30</height>
  </entry>
 </frame>
 <frame Autore>
  <entry max_length="25">
   <default>'"$autore"'</default>
   <variable>aut</variable>
   <width>300</width><height>30</height>
  </entry>
 </frame>
</hbox>
<hbox>
 <frame Genere>
  <entry max_length="25">
   <default>'"$genere"'</default>
   <variable>gen</variable>
   <width>300</width><height>30</height>
  </entry>
 </frame>
 <frame Anno>
  <entry max_length="4">
   <default>'"$anno"'</default>
   <variable>ann</variable>
   <width>300</width><height>30</height>
  </entry>
 </frame>
</hbox>
<hbox>
 <frame Editore>
  <entry max_length="25">
   <default>'"$editore"'</default>
   <variable>edi</variable>
   <width>300</width><height>30</height>
  </entry>
 </frame>
 <frame Formato>
  <entry max_length="25">
   <default>'"$formato"'</default>
   <variable>form</variable>
   <width>300</width><height>30</height>
  </entry>
 </frame>
</hbox>
<hbox>
 <frame Note>
  <edit>
   <default>'"$note"'</default>
   <variable>not</variable>
   <width>300</width><height>150</height>
  </edit>
 </frame>
</hbox>
<hbox>
 <button cancel></button>
 <button>
  <label>Applica modifica</label>
 </button>
</hbox>
</vbox>
</window>
'
I=$IFS ; IFS=""
for STATEMENTS in $(gtkdialog --program=MODIFICA); do
 eval $STATEMENTS
done
if [ "$EXIT" = "Applica modifica" ] ; then
 tit=$(echo $tit) ; aut=$(echo $aut) ; gen=$(echo $gen) ; ann=$(echo $ann) ; edi=$(echo $edi) ; form=$(echo $form) ; not=$(echo $not)
 if [ -z "$gen" ] ; then gen="-" ; fi ; if [ -z "$ann" ] ; then ann="-" ; fi ; if [ -z "$edi" ] ; then edi="-" ; fi ; if [ -z "$not" ] ; then not="-" ; fi ; if [ -z "$tit" ] ; then tit="-" ; fi ; if [ -z "$aut" ] ; then aut="-" ; fi
 tit=${tit//|/¦} ; aut=${aut//|/¦} ; gen=${gen//|/¦} ; ann=${ann//|/¦} ; edi=${edi//|/¦} ; not=${not//|/¦}
 if [ "$form" != "brossura" ] && [ "$form" != "rilegato" ] && [ "$form" != "digitale" ] ; then form="brossura" ; fi
 modif1=$CERCA"|"$titolo"|"$autore"|"$genere"|"$anno"|"$editore"|"$formato"|"$note
 modif=$CERCA"|"$tit"|"$aut"|"$gen"|"$ann"|"$edi"|"$form"|"$not
 sed -i "/$modif1/c $modif" "$dir"
fi
}
export dir=$(find /home/$USER -name 'database_libri')
if [ "$dir" = "" ] ; then
 export dir="/home/$USER/database_libri"
fi
export _DATA_BASE_="$dir"
export -f FIND_BOOK
export -f AGGIUNGI_LIBRO
export -f CONFERMA_ELIMINA
export -f MODIFICA
export MAIN_DIALOG='
<window title="Libreria" window_position="1">
 <vbox>
  <frame Database>
   <hbox>
    <tree file-monitor="true" auto-refresh="true" selection-mode="1">
     <width>750</width><height>350</height>
     <variable>TABLE</variable>
     <label>ID | Titolo | Autore | Genere | Anno | Editore | Formato | Note</label>
     <input file>'$_DATA_BASE_'</input>
     <action>refresh:TABLE</action>
    </tree>
   </hbox>
   <hbox>
    <button use-stock="true" label="gtk-add">
     <action signal="clicked">AGGIUNGI_LIBRO</action>
     <action>refresh:TABLE</action>
    </button>
    <button use-stock="true" label="gtk-remove">
     <action>if [ "$TABLE" != "" ];then CONFERMA_ELIMINA;fi</action>
     <action>refresh:TABLE</action>
    </button>
   </hbox>
  </frame>
  <frame Cerca Records per tipo>
   <hbox>
    <radiobutton>
     <label>Generico</label>
     <default>true</default>
     <variable>VAR_GENERICO</variable>
    </radiobutton>
    <radiobutton>
     <label>Titolo</label>
     <variable>VAR_TITOLO</variable>
     <action>refresh:TARGET_ITEM</action>
    </radiobutton>
    <radiobutton>
     <label>Autore</label>
     <variable>VAR_AUTORE</variable>
     <action>refresh:TARGET_ITEM</action>
    </radiobutton>
    <radiobutton>
     <label>Genere</label>
     <variable>VAR_GENERE</variable>
    </radiobutton>
    <radiobutton>
     <label>Anno</label>
     <variable>VAR_ANNO</variable>
    </radiobutton>
    <radiobutton>
     <label>Editore</label>
     <variable>VAR_EDITORE</variable>
    </radiobutton>
    <radiobutton>
     <label>Formato</label>
     <variable>VAR_FORMATO</variable>
    </radiobutton>
   </hbox>
   <hbox>
    <tree rules-hint="true">
     <width>750</width><height>150</height>
     <variable>CERCA</variable>
     <label>ID | Titolo | Autore | Genere | Anno | Editore | Formato | Note</label>
     <input>"FIND_BOOK"</input>    
    </tree>        
   </hbox>  
   <hbox>
    <text>
     <label> Cerca Qui, Inserire pattern:</label>
    </text>
    <entry editable="true" space-expand="false">
     <height>30</height> <width>400</width>
     <variable>TARGET_ITEM</variable>
     <action>"FIND_BOOK $TARGET_ITEM"</action>
     <action>refresh:CERCA</action>
    </entry>
   </hbox>
   <hbox>
    <button>
     <label>Modifica</label>
     <action>if [ "$CERCA" != "" ];then MODIFICA;fi</action>
     <action>refresh:TABLE</action>
     <action>refresh:CERCA</action>
    </button>
    <button use-stock="true" label="gtk-remove">
     <action>if [ "$CERCA" != "" ];then CONFERMA_ELIMINA;fi</action>
     <action>refresh:TABLE</action>
     <action>refresh:CERCA</action>
    </button>
   </hbox>
  </frame>
   <vbox>
    <button>
     <label> Esci </label>
     <action type="exit">Exit</action>
    </button>
   </vbox>
  </vbox>
</window>
'
export INSERIMENTO='
<window title="GESTIONE LIBRERIA">
<vbox>
 <frame inserimento Titolo>
  <entry max_length="25">
   <variable>titolo</variable>
   <width>450</width><height>30</height>
  </entry>
 </frame>
 <frame inserimento Autore>
  <entry max_length="25">
   <variable>autore</variable>
   <width>450</width><height>30</height>
  </entry>
 </frame>
 <frame inserimento Genere>
  <entry max_length="25">
   <variable>genere</variable>
   <width>450</width><height>30</height>
  </entry>
 </frame>
 <frame Inserimento Editore>
  <entry max_length="25">
   <variable>editore</variable>
   <width>450</width><height>30</height>
  </entry>
 </frame>
 <frame Inserimento Anno 1a Pubblicazione>
  <entry max_length="4">
   <variable>anno</variable>
   <width>450</width><height>30</height>
  </entry>
 </frame>
 <frame Formato>
  <table>
    <width>450</width><height>110</height>
    <variable>formato</variable>
    <item>() brossura</item>
    <item>() rilegato</item>
    <item>() digitale</item>
  </table>
 </frame>
 <frame inserimento Note>
  <edit editable="true">
   <variable>note</variable>
   <width>450</width><height>150</height>
  </edit>
 </frame>
  <hbox>
   <button cancel></button>
   <button ok></button>
  </hbox>
</vbox>
</window>
'

gtkdialog --program=MAIN_DIALOG

exit 0
alla fine ho capito tutto, mi rimane questo:
Codice:
export _DATA_BASE_="$dir"
perchè esporta il contenuto del file nella variabile?
 

« MoMy »

Utente Èlite
1,529
771
In realtà fai una sostituzione e rendi _DATA_BASE_ utilizzabile in ogni subshell prodotta dallo script.
La differenza tra:

É lo stesso ma lo metto comunque:
Codice:
a=lettera; a=$b; echo $b
# Risultato lettera

a=lettera; export a=$b; echo $b
# Risultato lettera
è che $a è diponibile per ogni processo figlio o subshell. :P
Codice:
a=lettera; b="numero uno due"; a=$b; echo $a
# Risultato: numero uno due
e
a=lettera; b="numero uno due"; export a=$b; echo $a
# Risultato: numero uno due
 
Ultima modifica:
  • Mi piace
Reazioni: rebellion

xskah

Utente Attivo
328
131
stai usando la porta 25 o la 5xx? (non ricordo il numero preciso)

per hotmail la porta è 587..

Non è questione porta, Thunderbird configura in automatico e fino a 20 giorni fa funzionava tutto bene. Il problema è a monte. Archlinux non riconosce il server smtp-mail.outlook.com, credo a causa di aggiornamenti di qualche pacchetto, ma quale? :muro:
Ubuntu invece non presenta problematiche :boh:
 

r3dl4nce

Utente Èlite
16,960
9,260
Ma il resolver DNS ti funziona?
Cosa ti dice se scrivi
dig smtp-mail.outlook.com
E qual'è il contenuto di /etc/resolv.conf ?
 

e_ale92

Utente Èlite
17,011
5,013
CPU
Intel® Core™ i7-920 Processor - @3.33GHz
Dissipatore
Stock Intel
Scheda Madre
Asus P6T - socket LGA 1366
HDD
Samsung 830 128GB + Samsung Spinpoint F4 320GB + Seagate Barracuda 1,5 TB
RAM
Corsair DDR3 1333MHz CL9 XMS3 DHX (3x2GB) - @1674MHz
GPU
MSI R6970 Lightning
Audio
Realtek ALC 1200
Monitor
HP 2310i
PSU
XFX Pro 750W Core Edition
Case
Cooler Master HAF 922
Periferiche
R.A.T. 5 Cyborg Mad Catz - Keycool KC84
OS
Arch Linux + Windows 10 Pro
Non è questione porta, Thunderbird configura in automatico e fino a 20 giorni fa funzionava tutto bene. Il problema è a monte. Archlinux non riconosce il server smtp-mail.outlook.com, credo a causa di aggiornamenti di qualche pacchetto, ma quale? :muro:
Ubuntu invece non presenta problematiche :boh:
già che ci sei, controlla il log di pacman così vedi l'elenco dei pacchetti aggiornati, utile per capire il responsabile e per un eventuale downgrade.
 

xskah

Utente Attivo
328
131
Ma il resolver DNS ti funziona?
Cosa ti dice se scrivi
dig smtp-mail.outlook.com
E qual'è il contenuto di /etc/resolv.conf ?
il resolver non so se funziona. Se scrivo dig smtp-mail.outlook.com, mi dice comando sconosciuto, se digito
ping smtp-mail.outlook.com mi dice nome o servizio sconosciuto, resolv.conf contiene i dns forniti dall'isp

già che ci sei, controlla il log di pacman così vedi l'elenco dei pacchetti aggiornati, utile per capire il responsabile e per un eventuale downgrade.
Sto indagando

@xskah Il ping su smtp-mail.outlook.com a me funziona su Arch, quindi, se pinghi google o altro host ¿qué pasa?
Ho problemi a pingare solo quel maledetto server, riesco anche a pingare imap.mail.outlook.com.
Domande:
- provider diverso dal mio, che è fastweb?
- hai fatto qualche modifica alle configurazioni di default, tipo dns, resolv.conf?(Mai toccati)
Per il momento ho risolto con un metodo grossolano e forse anche obsoleto; spulciando Ubuntu ho visto che si avvale del servizio dnsmasq e quindi il suo resolv.com contiene solo 127.0.1.1 e non i dns fastweb. Ho creato il file /etc/resolv,conf.head e messo dentro i dns google. Vorrei Tanto capire cosa sia successo.
 

rebellion

Utente Èlite
1,593
506
CPU
intel i5 9500
Dissipatore
cooler master hyper 212 evo
Scheda Madre
asrock b360 pro4
HDD
samsung 850evo 250GB+samsung 840pro 128GB+seagate barracuda 2TB+seagate barracuda 2TB
RAM
corsair vengeance lpx ddr4 2133MHz 2x4GB CL13
GPU
integrata intel hd graphics 630
Audio
integrata
Monitor
samsung ue55mu6500u
PSU
xfx pro series 550w core edition
Case
mastercooler
OS
archlinux x64 + gnome3.34.1 && windows10 pro x64
Ho problemi a pingare solo quel maledetto server, riesco anche a pingare imap.mail.outlook.com.
anch'io pingo e non ho fatto modifiche.

((aggiornando ho avuto solo problemi col pacchetto mkinitcpio-busybox e uefi-grub.))
 

« MoMy »

Utente Èlite
1,529
771
Domande:
- provider diverso dal mio, che è fastweb?
- hai fatto qualche modifica alle configurazioni di default, tipo dns, resolv.conf?(Mai toccati)
Sono con la Tim (no fibra) e uso i dns open impostati nel resolv.
Usi qualche firewall, qualche configurazione particolare nel modem/router?
 

e_ale92

Utente Èlite
17,011
5,013
CPU
Intel® Core™ i7-920 Processor - @3.33GHz
Dissipatore
Stock Intel
Scheda Madre
Asus P6T - socket LGA 1366
HDD
Samsung 830 128GB + Samsung Spinpoint F4 320GB + Seagate Barracuda 1,5 TB
RAM
Corsair DDR3 1333MHz CL9 XMS3 DHX (3x2GB) - @1674MHz
GPU
MSI R6970 Lightning
Audio
Realtek ALC 1200
Monitor
HP 2310i
PSU
XFX Pro 750W Core Edition
Case
Cooler Master HAF 922
Periferiche
R.A.T. 5 Cyborg Mad Catz - Keycool KC84
OS
Arch Linux + Windows 10 Pro
a proposito di DNS: usate quelli Google o quelli Open? perché?
 

davethecipo

Utente Èlite
3,331
1,163
CPU
i5 4660
Scheda Madre
H97 PC Mate
HDD
qualcuno
RAM
8 GB
GPU
R9 280
Monitor
Samsung SyncMaster 940BW 19'
PSU
Enermax Liberty 620W
Case
Enermax Pandora Midi Tower Black
OS
Arch Linux con KDE...Windows 10
@e_ale92 Google così mi spia meglio
 
  • Mi piace
Reazioni: e_ale92

cdtux

Utente Èlite
1,829
911
CPU
I7 3770
Scheda Madre
Asrock Z77 Extreme 4
HDD
Samsung 850 pro 250GB
RAM
Corsair Vengeance LP 16GB
GPU
Gigabyte GTX1060 6GB
Monitor
Dell U2412M
PSU
Seasonic Focus Plus 650
Case
Corsair Graphite 760T
OS
Debian / Ubuntu
@e_ale92 Quelli di google.. sono più facili da ricordare :lol:
 

davethecipo

Utente Èlite
3,331
1,163
CPU
i5 4660
Scheda Madre
H97 PC Mate
HDD
qualcuno
RAM
8 GB
GPU
R9 280
Monitor
Samsung SyncMaster 940BW 19'
PSU
Enermax Liberty 620W
Case
Enermax Pandora Midi Tower Black
OS
Arch Linux con KDE...Windows 10
@cdtux in effetti la tua è l'unica risposta sensata
 
  • Mi piace
Reazioni: cdtux

Entra

oppure Accedi utilizzando
Discord Ufficiale Entra ora!

Discussioni Simili