Ungalubeka kanjani usuku nesikhathi okuhlala kubonakala ku-terminal

Bathi isithombe sibiza amagama ayinkulungwane, yingakho ngaphambi kokuthi ngichaze okuthile, ngizokukhombisa ukuthi uyini umphumela womyalo engizowufaka kamuva:

isikhathi_esiphelile Qaphela ukuthi ekhoneni eliphezulu kwesokudla silubona kanjani usuku lweviki (ILanga, iSonto), inyanga (Dec), usuku (22) kanye nehora, umzuzu, isibili nonyaka.

Kuyinto evuselelwa ngesikhathi sangempela, okungukuthi, yonke imizuzwana leyo mininingwane ivuselelwa, futhi izohlala ikhona ekhoneni eliphezulu kwesokudla kwesiginali.

Lokhu kuyinto ewusizo ngoba, singahlela ifayili nge-nano noma vi, singafaka noma yiluphi uhlobo lwensizakalo noma siphathe noma ngabe kuyini, futhi ngeke sidinge ukumisa esikwenzayo, sikhiphe usuku ku-terminal ukwazi usuku noma isikhathi, Ngaleli phuzu engikubonisa lona, ​​sizohlala silikhumbula njalo.

Ukufeza lokhu esigungwini masibeke okulandelayo:

while sleep 1;do tput sc;tput cup 0 $(($(tput cols)-29));date;tput rc;done &

Lokhu njengoba kungewona umyalo noma umyalo olula, kepha inyunyana yabo ... woza, iskripthi singaba njalo. Ukukuchaza kunzima kakhulu, noma kunjalo ngizokwenza konke okusemandleni ami 🙂

  • ngenkathi ulele 1; yenza : Lokhu kusho ukuthi njalo emzuzwini olandelayo kuzokwenziwa
  • tput sc : Kusho ukuthi isikhundla samanje sizogcinwa, okusho ukuthi, isikhundla salokho okuzayo ngokulandelayo sizogcinwa, ngeke kudingeke ukukucacisa ngemuva kokukodwa.
  • inkomishi ye-tput 0$ (($ (tput cols) -29)) : Lokhu kungabonakala kunzima kepha, akunzima kangako. Ngokuyinhloko yilokhu okushiwo isikhundla, okungukuthi, ekhoneni eliphezulu kwesokudla. Ipharamitha yenkomishi icacisa isikhala esime mpo esizoba khona, njengoba sibeka u-0 ngakho-ke kusho ukuthi "ngenhla, phezulu". Lapho ukuma okumi mpo sekuchaziwe, singabona ukuma okuvundlile, okunakekelwa yiminye imingcele, ukuyibeka kalula ... ibala amakholomu akhona futhi iqiniseke ukuthi ilungile onqenqemeni olungakwesokudla. Uma ufisa, shintsha inombolo 29 uyenzele abanye uzowubona umehluko.
  • Usuku : Kulula lokhu, usuku lusikhombisa imininingwane esiyibonayo ... usuku, inyanga, ihora, njll.
  • tput rc : Bayi-tput sc sigcina isikhundla, manje nge-tput rc siyayibuyisela.
  • Kwenziwe : Lapha siqeda konke, lokho esikuqale ngesikhathi.

Njengoba ukwazi ukubona, i-terminal ngokungangabazeki iyindawo enhle, uma umyalo ungenzi ngqo lokho esikufunayo ... singajoyina eziningana zazo futhi sifeze lokho esikufunayo. Bona umyalo ngamunye njengethuluzi, ithuluzi (isando) alinakusenza isithombe esihle, kepha, ngokujoyina leli thuluzi (isando) nabanye (ukhuni nesisi) singafinyelela kumphumela wamaphupho 🙂

O, ngasendleleni ... uma ufuna ukuthi lokhu kuvele njalo esigungwini ngaphandle kokukwenza ngaso sonke isikhathi lapho uvula ikhonsoli, kufanele uyibeke ku .bashrc, okungukuthi:

echo "while sleep 1;do tput sc;tput cup 0 \$((\$(tput cols)-29));date;tput rc;done &" >> $HOME/.bashrc

Khona-ke uma ufuna ukuyisusa, sebenzisa okulandelayo:

sed -i "s/while sleep 1/#while sleep 1/" $HOME/.bashrc

Akunalutho olunye ongangeza ngalo, ngiyethemba kube usizo

Phendula ngokucaphuna

eqinile

echo "ngenkathi ulele 1; do tput sc; tput cup 0 \ $ ((\ $ (tput cols) -29)); date; tput rc; done &" >> $ HOME / .bashrc


Okuqukethwe yi-athikili kunamathela ezimisweni zethu ze izimiso zokuhlelela. Ukubika iphutha chofoza lapha.

Amazwana ayi-21, shiya okwakho

Shiya umbono wakho

Ikheli lakho le ngeke ishicilelwe. Ezidingekayo ibhalwe nge *

*

*

  1. Ubhekele imininingwane: Miguel Ángel Gatón
  2. Inhloso yedatha: Lawula Ugaxekile, ukuphathwa kwamazwana.
  3. Ukusemthethweni: Imvume yakho
  4. Ukuxhumana kwemininingwane: Imininingwane ngeke idluliselwe kubantu besithathu ngaphandle kwesibopho esisemthethweni.
  5. Isitoreji sedatha: Idatabase ebanjwe yi-Occentus Networks (EU)
  6. Amalungelo: Nganoma yisiphi isikhathi ungakhawulela, uthole futhi ususe imininingwane yakho.

  1.   IGhermain kusho

    Ngiyabonga kodwa ayingisebenzeli ... Nokuba eKonsole noma kuYakuake ngenze konke njengoba kunjalo eposini. 🙁

    1.    IGhermain kusho

      Uxolo ... bekuyiphutha lami ... manje njengoba ngivuselele kabusha IYASEBENZA !!!

      1.    KZKG ^ Gaara kusho

        Kwakungimangaza ukuthi kwakungasebenzi, ngoba ngenkathi… usuku ne-tput kuyimiyalo evela kwiphakheji yeBash 😀

  2.   IGhermain kusho

    Angazi ... kwenzeke okuthile okuxakile ... kufakwa esibulalayo:

    echo "ngenkathi ulele 1; do tput sc; tput cup 0 $ (($ (tput cols) -29)); date; tput rc; done &" >> $ HOME / .bashrc

    Umphumela waba ukuthi:

    bash: /home/ghermain/.bashrc: umugqa 115: iphutha lesenzo eduze kwento engalindelekile `do '
    bash: /home/ghermain/.bashrc: umugqa 115: `PS1 = '$ {debian_chroot: + ($ debian_chroot)} [33 [01; 34m] u [33 [01; 32m] @ [33 [01; 32m] h [33 [00m]: [33 [01; 34m] w [33 [00m] $ 'ngenkathi ulele 1; do tput sc; tput cup 0 64; usuku; tput rc; kwenziwe &'

    Ngemuva kwalokho ngikopishe ngqo imiyalo oyinika ku-.bashrc ekugcineni futhi ngithola imigqa eminingana nosuku nesikhathi.

    1.    O_Pixote_O kusho

      Susa yonke imigqa oyifakile kufayela le-.bashrc osukwini bese ubeka umugqa ngesandla ngaphandle kokusebenzisa i-echo ukuthi uma inganikezi iphutha

  3.   Gonzalo kusho

    Inohlonze impela!

    1.    KZKG ^ Gaara kusho

      Siyabonga ngokufunda 🙂

  4.   jota eme kusho

    Kade ngifuna izindlela "zokuhlobisa" i-terminal esebenza kahle kepha epholile isikhathi eside, futhi lo myalo muhle kakhulu, hhayi njenge-baroque njengezinye izixazululo, kepha lapho ngifaka umyalo omude kunokudideka okuthile. Umyalo udla usuku bese usuku lubonakala ludla umyalo. Ngabe ukhona owaziyo ukuthi ngabe ikhona yini indlela yokuthi i-Prompt ibonakale umugqa owodwa wehla ngokuzenzakalela?
    Nokho, ngiyabonga!

  5.   UGregorio Espadas kusho

    Ithiphu enhle kakhulu 🙂

    1.    KZKG ^ Gaara kusho

      Ngiyabonga bhuti 😀

  6.   oscar kusho

    Siyabonga ngomngani wethiphu, kusebenza kahle. Ozithobayo.

    1.    KZKG ^ Gaara kusho

      Ngiyabonga ngokusifunda 🙂

  7.   truko22 kusho

    Kuhle 😀
    Noma ungadala i-alias bese uyisebenzisa lapho kudingeka 😀

  8.   UJames_Che kusho

    Kuyathakazelisa, ngizozama futhi emuva kwesikhathi

  9.   Juan kusho

    Kuhle kakhulu

  10.   jamin-samuel kusho

    Ngabe ungenza okuthunyelwe okuchaza ukuthi ungayifaka kanjani i-zsh ku-Debian / Ubuntu / Mint / Elementary nokuthi uzilungiselela kanjani izingqikithi?

    1.    KZKG ^ Gaara kusho

      Uff, angikaze ngisebenzise i-zsh, ngiyaxolisa 🙁

  11.   O_Pixote_O kusho

    I-KZKG ^ Gaara uma wenza umyalo inika iphutha ngoba ngicabanga ukuthi izama ukubona ama- $ angenanani, ukuze ingawahumushi, ukuwafaka \ kulungisiwe.

    echo "while sleep 1;do tput sc;tput cup 0 \$((\$(tput cols)-29));date;tput rc;done &" >> $HOME/.bashrc

    Ngicabanga ukuthi ngaleyo ndlela ngeke kube nankinga, ngiyilungise ngaphambi kokuthi nginike umuntu iphutha. Okuthunyelwe okuhle, ngizokusebenzisa. Ozithobayo.

    1.    KZKG ^ Gaara kusho

      Uff kwesokudla, iphutha lami 😀
      Sengivele ngiyilungisa kokuthunyelwe, ngiyabonga kakhulu ngokulungiswa 🙂

  12.   jvk85321 kusho

    Ngayilungisa futhi ngayishiya kanjalo

    ngenkathi ulele 1; do tput sc; tput cup 0 $ (($ (tput cols) -16)); date + »% R% d /% m /% Y»; tput rc; done &

    Kukhombisa kuphela ihora: Usuku Lwemizuzu ngefomethi DD / MM / YYYY

  13.   danyel kusho

    Umngani ovelele ngisebenze ukubonga okungu-100