Ответы пользователя по тегу bash
  • Как выделить цветом данные?

    artopp
    @artopp
    zsh# n=0; for d in /dev/sd{a..i}[[:digit:]]##(%bN); do print -n "Device $((n++ )) $(hddtemp $d 2>&1)" && print -P " %F{green}OK%f" || print -P " %F{red}FAIL%f"; done
    Device 0 /dev/sda1: WDC WD5000AAKB-00H8A0: 47°C OK
    Device 1 /dev/sdb1: Maxtor 6Y120L0: 42°C OK
    Device 2 /dev/sdb2: Maxtor 6Y120L0: 42°C OK
    Device 3 /dev/sdb3: Maxtor 6Y120L0: 43°C OK
    Device 4 /dev/sdb4: Maxtor 6Y120L0: 41°C OK
    Device 5 /dev/sdb5: Maxtor 6Y120L0: 42°C OK
    Device 6 /dev/sdb6: Maxtor 6Y120L0: 42°C OK
    Device 7 /dev/sdb7: Maxtor 6Y120L0: 41°C OK
    Device 8 /dev/sdb8: Maxtor 6Y120L0: 41°C OK
    Device 9 /dev/sdb9: Maxtor 6Y120L0: 41°C OK
    Device 10 /dev/sdb10: Maxtor 6Y120L0: 42°C OK
    Device 11 /dev/sdc1: ST3360320AS: drive is sleeping OK
    Device 12 /dev/sdd1: KINGSTON SKC600256G: 43°C OK
    Device 13 /dev/sdd2: KINGSTON SKC600256G: 43°C OK
    zsh#
    Ответ написан
    Комментировать