Gina shirinku mataki zuwa mataki ta amfani da rubutun Shell - Sashe na 3

A cikin shigarwar da ta gabata a cikin wannan jerin wallafe-wallafen, mun tuno da yadda ake aiwatar da:

Scriptan ShellKuma a cikin wadanda suka gabata, yadda ake aiwatar da a Shebang da BSM (Yanayin Tsayayyar Bash / Tsattsauran Yanayin Bash).

Ayyuka mafi kyau don ƙirƙirar Rubutun Shell a cikin GNU / Linux - Sashe na 1

Ayyuka mafi kyau don ƙirƙirar Rubutun Shell a cikin GNU / Linux - Sashe na 2

Ga misalin wani Tsarin aiwatarwa sau biyu ko yanke hukuncin kisa, daukar misali daya daga na shirye-shirye (aikace-aikace) gaskiya a Rubutun Shell da ake kira Linux Post Shigar - Rubutun shekara biyu 8.0:

Wannan ya zama koyaushe (sashe) Don tabbatar da cewa rubutun baya aiki da gaske sabili da haka guji yin gudu sau biyu, ko kasawa cewa lokacin da ya gabata yana gudana, ya ƙare cikin nasara. Ni da kaina na ƙara waɗannan layi don ƙirƙirar wannan rukunin:


###############################################################################
# INICIO DEL MODULO DE DETECCIÓN DE DOBLE EJECUCIÓN ó EJECUCIONES FALLIDAS
###############################################################################

if [[ -f  $UBICACION/$FILE_LOCK ]]; then

   setterm -background red
   echo "El Script no podrá ejecutarse!"
   echo "Debido a que el Archivo de Bloqueo de doble ejecución lo impide."
   sleep 5 ; exit 0

 else

  touch $UBICACION/$FILE_LOCK

fi

###############################################################################
# FINAL DEL MODULO DE DETECCIÓN DE DOBLE EJECUCIÓN ó EJECUCIONES FALLIDAS
###############################################################################

===============

Shawara:

EDITOR VI

Ina jin cewa mutane da yawa don sauƙin amfani, idan ya zo gyara rubutunka ta hanyar m ya kamata amfani da edita nano wanda ba kawai yana da sauƙin sarrafawa ba amma kuma yana da zaɓuɓɓukan tsoho na yau da kullun don aiwatar da matakan gyare-gyare masu dacewa a cikin fayil ɗin rubutu bayyananne, kamar Rubutun Shell, duk da haka, mafi kyawun shawarwarina a wannan yanayin shine su koya kuma suyi amfani da Edita vi, wanda ba kawai yafi ci gaba ba, kodayake cikakke ne, amma da zarar an ƙware, zai samar da hanyoyin da ake buƙata don yin canje-canje ko aiki akan fayiloli ta hanyar da ta fi inganci da inganci.

A takaice dai, Vi ko Vim edita ne mai fa'ida sosai, wanda ke ba da babban sassauci lokacin gyara rubutun, gyaran fayilolin rubutu, tsakanin sauran nau'ikan fayiloli, amma sama da duka, lokacin shirye-shirye. A ganina, yana ɗaya daga cikin mafi kyawun editocin da ke wanzu, duk da haka, kamar yadda aka saba, idan masu amfani da Nano suka fara amfani da shi kuma suka ga wata hanyar amfani da su ta daban, yawanci yakan faru ne da gaske «Ko dai suna son shi ko sun ƙi shi. righ now ". Ina ganin yana da daraja koya yadda ake amfani da shi!

Tabbas, a farkon shigarwa yana iya zama alama editan rubutu mara kyau kuma tare da wahalar koyo, amma wannan da zarar an shawo kansa, yin amfani da ayyukan yau da kullun, yawan aiki yana ƙaruwa ta hanya mai ban mamaki.

Gaskiya ne cewa, Edita vi yana ko aiki tare Gajerun hanyoyi kuma bashi da menus ko maballin. Ana yin komai ta hanya umarni da gajerun hanyoyin jerin haruffa da alamu. Kuma wannan yana da matukar damuwa ga yawancin masu amfani waɗanda suka manta ko ba sa iya tuna sauƙin, duk da haka, yana ɗaukar ƙaramin faifai kaɗan kuma yana cikin kusan kusan duk Linux ko Unix da ke akwai. Kuma saboda shiri ne wanda ke gudana a cikin yanayin rubutu, yana da amfani don samun dama ta nesa da yin gyara ta hanyar tashar jirgin ruwa. Don haka, zamuyi amfani da wannan ɗan gajeren post ɗin don yin taƙaitaccen nazari game da yadda ake amfani da shi tun daga farko, don rasa wannan tsoron kuma ga fa'idar da yake da shi don koyon amfani da shi.

Ta hanyar kiran Edita vi yana bayyana akan allo yanayin gyara. A cikin wannan yanayin, ana nuna alamar siginan kwamfuta, kuma layin layi mara alama tare da hali ~ kuma a ƙasan allon ya bayyana layin matsayi, wanda ke nuna sunan fayil da adadin haruffan da ke ciki. Idan Edita vi wucewa hanya da sunan fayil azaman abin a maimaita, abinda ke ciki zai bayyana. Lokacin da aka gudanar da wannan editan tare da sunan fayil wanda babu shi, ana ƙirƙirar shi ta atomatik.

El Edita vi yana da hanyoyi biyu na aiki:

  • Shirya Yanayi: Don daɗa rubutu zuwa fayil ɗin.
  • Yanayin Umurnin: Don shigar da umarni da ke yin takamaiman ayyuka.

Lokacin ci gaba da shirya fayil ɗin rubutu tare da Edita vi, canje-canje ba a yin su kai tsaye a kai ba. Amma a zahiri, suna amfani da kwafin shi cewa Edita vi ƙirƙiri a cikin sararin ƙwaƙwalwar ajiya na ɗan lokaci da ake kira buffer. An canza ainihin fayil ɗin kawai lokacin da aka rubuta abubuwan da ke cikin buffer. Wannan yana da fa'ida da rashin amfani. A gefe guda, yana nufin cewa zaka iya dakatar da gyara fayil kuma ka watsar da duk canje-canjen da aka yi yayin wani zama, ka bar kwafin diski cikakke. A gefe guda, abubuwan da ba a yi rajista ba na ajiyar aiki na iya rasa idan tsarin ya fadi. Zai fi kyau ka adana aikinka akai-akai, musamman lokacin yin manyan canje-canje. Don adana fayil da ake shiryawa ba tare da fita daga ciki ba Edita vi, kawai danna umarnin a cikin yanayin umarni :w

Don ƙare aiwatar da Edita vi ana iya amfani da hanyoyi daban-daban, koyaushe a ciki Yanayin umarni:

: q ->   Rufe editan lokacin da ba'a canza canje-canje ga fayil din ba.
: q! ->    Rufe editan yana watsar da canje-canje a cikin fayil ɗin.
: wq ->   Rufe editan yana adana canje-canje ga fayil din.

Muhimmiyar: Ya kamata ku guji gyara fayil ɗin ɗaya tare da zama da yawa na Edita vi buɗe a lokaci guda, kamar yadda babu wata hanyar tabbatarwa wacce ce kwafin ƙarshe da za a zahiri za a yi rikodin a kan faifai.

A Shirya Yanayi: Lokacin da Edita vi, koyaushe yana farawa a cikin Yanayin umarni, don haka kafin ku iya ara, gyara ko share rubutu a cikin fayil ɗin dole ne ka rubuta ɗayan umarnin shigar da Edita vi, kamar su "I" (saka), don saka rubutu a matsayin siginan rubutu na yanzu, ko "A" (shafi) don saka rubutu bayan matsayin siginan kwamfuta na yanzu. Komawa zuwa Yanayin umarni, kawai danna maballin "Esc". Idan a cikin lokacin X baku san wane yanayi kuke ciki ba, kawai ta latsa maɓallin "Esc" daya tabbatar cewa yana ciki Yanayin umarni, kuma zaka iya komawa don ci gaba da aikin.

A Yanayin Dokoki: Lokacin da ka bude fayil tare da Edita vi, buɗe nan da nan a cikin Yanayin umarni. Kuma a cikin wannan yanayin zaku iya aiwatar da ayyuka (umarni) wanda ke aiwatar da wani kewayon ayyuka. Yawancin waɗannan umarni sun kunshi haruffa daya ko biyu da lambar zabi mai alaƙa da ayyuka daban-daban. Dokoki da yawa basa buƙatar danna maɓallin Komawa da za a zartar, amma duk umarnin da ke farawa tare da mallaka (:) na bukatar danna maballin Komawa don su gudu.

BABBAN UMARNI NA EDITA VI

Babban umarni na Edita vi, gwargwadon amfanin su yayin gyara takardu sune:

01.- Matsar a cikin fayil din
02.- Addara rubutu
03.- Gyara rubutu
04.- Cire gyare-gyare
05.- Share rubutu
06.- Matsar da / ko kwafe rubutu
07.- aiwatar da umarni a cikin yanayin EX
08.- Bincike da sauyawa
09.- Zubar da abun ciki daga wannan fayil zuwa wani
10.- Gyara fayiloli lokaci guda

Muhimmiyar: Umarnan Ubangiji Edita vi za a iya gabatar da su ta hanyar takarda wanda ke nuna sau nawa aikin ya kamata a maimaita su. Misali 3dd goge layuka 3, 2dw share kalmomi 2, kuma 4x share haruffa 4. Hakanan ana iya amfani da ƙidaya don umarni don matsar da allo, misali 3w o 2 Ctrl-F Latsa wani "." an sake maimaita aikin karshe da aka yi. Misali, idan aka goge layi kuma aiki na gaba shine goge layi, kawai latsa ".".

NOTE: Yawancin umarni na Edita vi ya ƙwaƙwalwar shari'arA takaice dai, irin umarnin da aka buga a babban ko ƙaramin rubutu na iya samun tasiri daban-daban.

Koyaya, don ƙarin bayani kuna iya bincika Intanit (Google ko Youtube) bayanan da suka shafi Edita vi, wanda yake da yawa da yawa a adabi da tallafi.

Koyaya, Na bar muku wannan GANGAR KARFE (SHATAR SHAT) hakan zai zama da amfani sosai don farawa a cikin Edita vi

tsawan3b3n_002 tsawan3b3n_001

Daga baya, a rubutun gaba zamu ci gaba da ganin misalin kayayyaki (sassan) waɗanda ke yin ayyuka kamar:

  • KYAUTATA MULKI
  • MULKIN HALITTA MAI AMFANI DA MAGANA
  • YADDA AKE GANE GASKIYAR LITTAFIN AIKI
  • MULKIN SIFFAN HARSUN HARSHE
  • PROXY CONFIGURATION ModULE DOMIN HUKUNCIN KISA

Daga cikin wasu da yawa!

Kuma kamar koyaushe, Ina ba da shawara tafi koyo ta hanyar koyar da kai game da umarni: gksu, maganganu, gxmessage, zenity, espeak, wasa, a tsakanin wasu da yawa don ƙirƙirar maɓallan zane ta Terminal ko don Tebur ɗin Mai amfani, tare da faɗakarwa ta sonic ko multimedia, da kuma ci gaban ilimin da zasuyi amfani dashi daga baya.

Ka tuna cewa waɗannan da duk wasu shawarwari akan wasu module, aiki, m, umarni ko aiki a gaba ɗaya ana iya aiwatar da shi hanyoyi da yawa, kuma abin da aka nuna anan ba komai bane face a hanya mai sauƙi, na da yawa hanyoyi masu yuwuwa a cikin abin da ya ce mataki na iya ko za a iya aiwatarwa!

Kawai don gamawa na bar ku, a Labarin allo da ni, don nuna muku abin da za ku iya, bayan kammala wannan Harshen rubutun Shell akan layi a cikin DesdeLinux:

LPI-SB8 Gwajin ScreenCast

(LINUX POST INSTALL - LITTAFIN BICENTENARIO 8.0.0) - Kashi na 2


Abubuwan da ke cikin labarin suna bin ka'idodinmu na ka'idojin edita. Don yin rahoton kuskure danna a nan.

Kasance na farko don yin sharhi

Bar tsokaci

Your email address ba za a buga.

*

*

  1. Mai alhakin bayanan: Miguel Ángel Gatón
  2. Dalilin bayanan: Gudanar da SPAM, gudanar da sharhi.
  3. Halacci: Yarda da yarda
  4. Sadarwar bayanan: Ba za a sanar da wasu bayanan ga wasu kamfanoni ba sai ta hanyar wajibcin doka.
  5. Ajiye bayanai: Bayanin yanar gizo wanda Occentus Networks (EU) suka dauki nauyi
  6. Hakkoki: A kowane lokaci zaka iyakance, dawo da share bayanan ka.