Cov txheej txheem:

Kuv yuav taug qab daim ntawv plhaub li cas?
Kuv yuav taug qab daim ntawv plhaub li cas?

Video: Kuv yuav taug qab daim ntawv plhaub li cas?

Video: Kuv yuav taug qab daim ntawv plhaub li cas?
Video: Kuv Tsis Paub Yuav Ua Li Cas - Tupao Xiong (Lyrics) 2024, Kaum ib hlis
Anonim

Plhaub tracing tsuas txhais tau tias taug qab kev ua tiav ntawm cov lus txib hauv a plhaub ntawv . Hloov rau plhaub tracing , siv qhov kev xaiv -x debugging. Qhov no directs lub plhaub los tso saib tag nrho cov lus txib thiab lawv cov lus sib cav ntawm lub davhlau ya nyob twg thaum lawv raug tua.

Ib yam li ntawd, tib neeg nug, Kuv yuav taug qab li cas bash tsab ntawv?

Pib koj bash tsab ntawv nrog bash -x./ tsab ntawv .sh los yog ntxiv rau koj tsab ntawv teeb -x kom pom debug tso zis. Koj tuaj yeem siv kev xaiv -p ntawm cov lus txib logger los teeb tsa ib qho chaw thiab theem los sau cov ntawv tso tawm ntawm syslog hauv zos rau nws tus kheej logfile.

Ib yam li ntawd, kuv yuav ua li cas thiaj li khiav lub plhaub ntawv hauv hom verbose? Hauv qab no yog cov kev xaiv thawj plhaub script debugging:

  1. -v (luv luv rau verbose) - qhia lub plhaub kom pom tag nrho cov kab hauv tsab ntawv thaum lawv nyeem, nws qhib hom verbose.
  2. -n (luv rau noexec lossis tsis muaj ecexecution) - qhia lub plhaub nyeem tag nrho cov lus txib, txawm li cas los xij tsis ua rau lawv.

Ntawm no, kuv yuav saib cov ntawv teev lus plhaub li cas?

Linux cov ntaub ntawv tuaj yeem saib nrog cov lus txib cd/var/ log , ces los ntawm ntaus ntawv lus txib ls saib cov ntaub ntawv khaws cia hauv phau ntawv no. Ib qho tseem ceeb tshaj plaws cov ntaub ntawv saib yog syslog, uas cov ntaub ntawv txhua yam tab sis cov lus hais txog kev lees paub.

Yuav ua li cas koj debug ib tsab ntawv?

Mus debug scripts:

  1. Pab kom Script Debugger los ntawm kev ua ib qho ntawm cov hauv qab no:
  2. Siv cov kev tswj hwm no los daws cov ntawv sau:
  3. Xaiv Pause ntawm kev ua yuam kev yog tias koj xav kom cov ntawv sau ncua thaum muaj kev ua yuam kev.
  4. Xaiv cov cuab yeej ntawv qhia zaub mov> Script Debugger.
  5. Ua ib tsab ntawv hu ua sub-script.
  6. Nyem Kauj Ruam Mus.

Pom zoo: