Iyo webhu izere neshoko remazwi rinogona kunge richivhiringidza kune vasiri-IT vanhu. Mamwe emazwi aya anogona kuve kodhi yekodhi, zvinyorwa kana script, zvidimbu, nezvimwe. Zvakanaka, maererano nekodhi yekodhi, zvese izvo zvinyorwa kana ruzivo rwakanyorwa uchishandisa mutauro wechirongwa uye nekuremekedza imwe syntax yekuumba algorithm kana chairo basa rinozoita chirongwa ichi.
Naizvozvo, kodhi yekodhi iri imwe yakati rebei izwi uye yakafara, kuve nekugona kuisawo mukati memamwe mazwi, nekuti snippet chidimbu chekodhi yekodhi iyo isinganyanye kuomarara zvakawandisa. Semuenzaniso, patinozvipira kuita webhu dhizaini kana isu tinofanirwa kuisa chikwangwani pane yedu webhusaiti, kazhinji vashambadzi vanopa seGoogle Adsense kana maAmazon Affiliates vanotipa snippet ine HTML kodhi kuti tikwanise kuiisa pane yedu webhusaiti. Naizvozvo harisi chirongwa chakazara, asi zvidiki zvidimbu zvinogadziriswa zvekodhi.
Mutauro wakadudzirwa vs mutauro wakasanganiswa:
Kana iwe uri kushamisika chii chinonzi script kana scriptIwe unofanirwa kuziva kuti pakuronga izwi iri rinoshandiswa kureva kodhi yekodhi yakanyorwa mune imwe mhando yemutauro wakadudzirwa (kazhinji nguva dzose). Uye ndeupi musiyano uripo kune echinyakare wakarongwa programming mitauro? Zvakanaka, kusiyana neizvi, kodhi yekodhi haina kunyorwa kamwe uye ikashandurwa kuita bhanari, asi muturikiri anodikanwa kuti aite seanopindirana uye nguva yega yega chirongwa chichaitwa, muturikiri anofanirwa kushandura kodhi kuti mushini unzwisise . Ndokunge, matanho akapfupikiswa angave:
- Nyora kodhi yekodhi zvechirongwa ichi uchishandisa imwe mitauro yekuronga kuumbiridza senge C, BASIC, C ++, Ada, ALGOL, D, COBOL, GO, Fortran, G, Lisp, Pascal, Swift, Visual Basic, nezvimwe. Iyo kodhi inogona kunyorwa mune chero zvinyorwa zvemavara kana kushandisa inowedzere yakazara yekuvandudza nharaunda kana IDE.
- Isu tinonyora kodhi yacho sosi uchishandisa imwe compiler, senge GNU GCC. Nezve izvi isu tinokwanisa kushandura iwo mirairo kuita mutauro wepamusoro-soro unongonzwisiswa nevanogadzira programmeri mumushini kana bhainari mutauro unonzwisisika kana kuitiswa neCPU.
- El binary inogona kuurayiwa nguva zhinji sezvatinoda tisingapfuure nematanho apfuura zvekare. Muchokwadi, vazhinji vatengesi vema software vanotitumira iyo binary zvakananga kuti tishandise pakombuta yedu. Ichave iyo inoshanda sisitimu iyo inogadzirisa maitiro anodikanwa kune izvi, syscalls, nezvimwe.
Kune rimwe divi, zvinyorwa hazviteedzere matanho aya uye mitauro inodudzirwa inoshandiswa. Kune akawanda mitauro yakadudzirwa, senge iyo yakashandiswa muturikiri weBash, unova unonyanya kushandiswa muGNU / Linux uye imwe Unix, pamwe nemitauro inozivikanwa sePerl, Python, Ruby, JavaScript, nezvimwe. Navo unogona kunyora kodhi iyo ichagadzira iyo script inozove isiri chinhu kunze kwekuraira faira kana batch kugadzira. Zviripachena zvichienderana nemutauro unoshandiswa, syntax ichasiyana. Panyaya yemutauro wakadudzirwa, iwo marongero aizochinja kuita:
- Isu tinonyora iyo script kana sosi kodhi uchishandisa chero mutauro chirongwa. Tinogona zvakare kushandisa IDE kana kungoita zvinyorwa zvemavara.
- Mune ino kesi, haina kunyorwa, asi inogona kuurayiwa zvakananga nerubatsiro rwemuturikiri. Ndokunge, kana tikashandisa Bhash, isu tinoda kuti riiswe pane system kuti tikwanise kuita yedu script. Kana isu tikashandisa iyo Python script, isu tinoda iyo Python muturikiri akaisirwa, nezvimwe.
- When isu tinomhanya script, Achave muturikiri anodudzira mazwi kana mutauro urimo (nekudaro zita rawo), kureva kuti, mirairo iyi haipfuure yakanangana nehurongwa hwekushandisa neCPU, nekuti zvaisazozviziva pasina rubatsiro rwemurevereri. kana muturikiri ari muturikiri.
Tataura izvi, tinoona kuti mune imwe nyaya kana imwe iripo zvakanaka nezvakaipa. Muchiitiko chemafaira akaunganidzwa, ivo havadi kuunganidzwa panguva yekumhanya, nekudaro, kana yangonyorwa kekutanga, tinogona kuita bhanari kakawanda sezvatinoda pasina kutambisa zviwanikwa pazviri. Izvi hazvisizvo mune zvinyorwa, izvo zvinofanirwa kugovera zviwanikwa zvakare kune muturikiri, saka zvinomhanya zvishoma nezvishoma mune zvakajairika.
Kugadzira yedu yekutanga script paLinux:
Mumuenzaniso wedu tiri kuzoshandisa mutauro waBash wakadudzirwa, uye nekudaro muturikiri wedu achave Bhash. Chekutanga pane zvese isu tinofanira kuziva kuti vazhinji script mafaera ane misoro inozivikanwa se shebang zvinoenderana nemuturikiri akashandiswa. Semuenzaniso, muLinux tinokwanisa kuwana vaturikiri vakasiyana, mune nyaya yaBash, iyo shibang ndi #! / Bin / bash, asi mune chero imwe nyaya ichave iri bhanari iyo inonongedza muturikiri kana goko mune ino kesi. Zvakare, mune kesi yeUnix neLinux, iyo script faira inowanzo kuve nekuwedzera .sh.
Mune iyo script isu tinogona kushandisa muturikiri mirairo, oparesheni, maumbirwo, nezvimwe. Semuenzaniso, tinogona kugadzira chinyorwa chakareruka kugadzira makopi ekuchengetedza pane yedu system uye kugadzira rekodhi ine zuva rekugadzira iyo faira inonzi backup.sh pamwe neyedu yekuda mavara edhita. Zvirimo zvichave:
<div> <pre><span class="com">#<span class="simbol">!</span>/bin/bash </span></pre> <pre>tar cvf /backup/copia<span class="simbol">.</span>tar /home/usuario</pre> <pre>date <span class="simbol">></span> /backup/log_copia</pre> </div>
Semuenzaniso, mumuenzaniso uri pamusoro iwe unogadzira kopi yekuchengetedza yeiyo / imba / mushandisi dhairekitori uye kurongedza mune tarball inonzi copy.tar, wobva wanyora date danda. Kuti tiite, isu tichafanirwa kumupa mvumo yekuita, semuenzaniso:
chmod +x backup.sh ./backup.sh
Muenzaniso wakapusa Ini ndinofunga izvo kune vakawanda vanoziva chinonzi script. Ndeupi mubvunzo unodzokororwa nguva pfupi yadarika ...
Ndino shandura sei desktop.ini
Kwazisa
Zvakanaka, tenda kunaka iwe wakatsanangura nenzira yakapusa. Ndine zvese zvakajeka ... chete izvo zvandinozofanirwa kutsvaga chiri "bash" ,, "snippets", syscalls, nezvimwewo nezvimwewo, nezvimwe, zvese zvakajeka. Chinhu chimwe chete chidiki, hapana chimwezve; Kana ini ndikawana hwindo rinondipa matatu sarudzo (kukanzura uye mamwe maviri, ini handirangarire) nezve script, chii chandinofanira kuita zvakajairika? Ndingaunze imwe mhando yehutachiona? Nekuti ini handirangariri ndichida kudzikisa chero chinhu saka zvakanzi hwindo rinobuda. Tsanangura kune yakashata, ndapota
Yakandibatsira zvakanyanya, zvakadaro kodhi yemuenzaniso inovhiringidza sezvo ini ndisingazive mazhinji ema Labels, ndinoshuva dai iwe waisa izvo chinhu chimwe nechimwe chawakaisa mukodhi ichi uye nekudaro unachinzwisisa zvakanaka, iniwo ndaive ndisina chokwadi iyo i .sh faira?