I-Bash: Ungasenza kanjani iskripthi esisebenzisekayo

Ngifuna kancane kancane ukufaka izindatshana BashYebo, nginokuqukethwe okwanele ukukufundisa kancane kancane amathiphu, ukwenza imibhalo, nokunye okuningi, ukuze imisebenzi yethu yansuku zonke izenzekele, ngakho-ke kusobala ukuthi izosongela isikhathi esiningi

Manje ngizokukhombisa izisekelo, ozodinga ukukwazi njalo, futhi lokho kuzongisiza kukho konke okunye ukufundisa 😉

/ Ungasenza kanjani iskripthi se- .sh?

Ilula ... ilula kakhulu 😀

1. Vula i-terminal, kuyo bhala okulandelayo bese ucindezela [Faka]:

cd $HOME && touch script.sh && chmod +x script.sh

Lokhu kuzokwanela ukubakhela ifayela script.sh in yakhe ifolda yomuntu siqu.

2. Esigungwini faka okulandelayo:

cd $HOME && echo '#!/bin/bash' > script.sh && echo '# -*- ENCODING: UTF-8 -*-' >> script.sh

3. Silungile, usulungele ukubhala kwakho 😀

Uma siyivula, sizoba nokuthile okufana nalokhu:
#!/bin/bash
# -*- ENCODING: UTF-8 -*-

Ngemuva kwalowo mugqa wesibili, kusuka lapho imiyalelo iyabhalwa.

Isibonelo, sizokutshela ukuthi usibonise ku-terminal «<° I-Linux iyona ehamba phambili»😀

Sizoba nesikripthi ngokulandelayo:
#!/bin/bash
# -*- ENCODING: UTF-8 -*-
echo "<° Linux es lo mejor"
exit

/ Ungasisebenzisa kanjani noma uvivinye iskripthi se-.sh?

1. Kufanele siye kufolda lapho umbhalo ukhona, kusibonelo esedlule kungaba ifolda yethu, ngakho-ke sivula i-terminal, kuyo sibhala okulandelayo bese sicindezela [Faka]:

cd $HOME

2. Manje sikwenza ngokubeka iphuzu kanye ne-slash (elandelwayo), bese silandelwa igama lombhalo, okungukuthi:

./script.sh

Futhi ibhingo, sesivele sinalo 😀

Kwenze uzobona ...

Manje imininingwane ebalulekile, ekugcineni kufanele babeke njalo «Phuma«

Futhi manje, akukho okunye ongangeza, vele ulinde izifundo ezizayo, lapha uzofunda bash HAHA.

Phendula ngokucaphuna


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

Amazwana ayi-57, 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.   oscar kusho

    Ngiyabonga mngani, bengihlala ngifisa ukwazi ukuthi ngenza kanjani i-script.sh, manje sekuyisikhathi sokufunda, ngizobe ngilinde okokufundisa okulandelayo.

    1.    I-KZKG ^ Gaara <"Linux kusho

      Nah, injabulo hehe 😀
      Uzobona ... kancane kancane ngizobe ngibeka okokufundisa kweBash, ukubona ukuthi umuntu othile uyajabula yini, afunde futhi sonke sibe ngcono HAHA.

      Phendula ngokucaphuna

      1.    Jose kusho

        Sawubona, ngingaludinga usizo lwakho uma ungangisiza ngemibhalo ethile engiyibambile futhi engidinga ukuyenzela isifundo, ngingathanda ukuxhumana nami.
        Ngiyabonga kakhulu kusengaphambili

  2.   pardo kusho

    Ah uyafa !! kuhle 😉

    1.    I-KZKG ^ Gaara <"Linux kusho

      Ngiyabonga 😀
      Khumbula ukuthi izikhalazo noma iziphakamiso zizohlala zamukelwa kahle 😉

  3.   i-taregon kusho

    Ngikuthandile okuthunyelwe, noma nini lapho ngidinga iheda yeskripthi ngiqala ukuzulazula kuphela ukuthola umugqa: "#! / Bin / bash" kusihloko (ngiyakhohlwa kakhulu). Manje ngalo mnikelo sengingawenza ubhalwe phansi bese ngikopisha unamathisele 😀

    1.    I-KZKG ^ Gaara <"Linux kusho

      Khumbula ukuthi ngu / bash no / sh… kwehlukile haha, ngake ngachitha izinsuku ezimbili ngilwa nombhalo ongangisebenzelanga njengoba kufanele, futhi kungenxa yokuthi ngabeka i-sh esikhundleni se-bash 😀

      Noma yimiphi imibuzo ositshela yona.
      Phendula ngokucaphuna

  4.   umabhebhana kusho

    Jaajajajajaja futhi lokhu kulula kakhulu, futhi ungavula i-gedit noma yimuphi umhleli bese ukopisha:

    #!/bin/bash
    # -*- ENCODING: UTF-8 -*-
    echo “<° Linux es lo mejor”
    exit

    Futhi-ke siyinika izimvume zokwenza….

    idatha enhle kakhulu .. imikhonzo

    1.    I-KZKG ^ Gaara <"Linux kusho

      hehe yebo, lokho bekungenziwa kanjena, kepha angazi ... bengicabanga ukuthi kuzoba lula ukwenza ikhophi / unamathisele kolayini ababili (okungaba munye empeleni) futhi kuphelele lapho, lungisa iskripthi esinezimvume zokwenza kanye nesihloko 😀

    2.    I-Bertholdous kusho

      Sawubona. Ngabe imibhalo kufanele ihlale igcinwa njengefayela le-.sh?

      Kumawindi okufana kwawo kungaba amafayela we-bat. Ngokuqondene nokubhala kwabo, kubukeka kulula kakhulu.

  5.   ULucas Matias kusho

    Kuhle kakhulu che

    1.    I-KZKG ^ Gaara <"Linux kusho

      Ngiyabonga 😀

  6.   i-arturo molina kusho

    Ngibheke phambili kokuthunyelwe okulandelayo futhi okwamanje ngizoqaphela.

    1.    I-KZKG ^ Gaara <"Linux kusho

      (I.
      Noma iziphi iziphakamiso, umbhalo ofuna ngiwenze noma okuthile? 😀

  7.   Isibindi kusho

    Nguye lo ongazi ukuthi angahlela kanjani? Noma kulula, kuhlela

    1.    I-KZKG ^ Gaara <"Linux kusho

      HAHAHA woza ... ujabulile? ... funda okuncane kweBash, uzobona ukuthi kukhulu kangakanani, awudingi ukwazi ukuthi ungahlela kanjani, ukude nakho 😀

      Uthini?

      1.    Isibindi kusho

        Ngizokwenza, namuhla angiyena lowo

  8.   engaziwa kusho

    Eqinisweni, uma imibhalo izokwakhiwa njalo, umsebenzi uqobo ungazenzakalela ngesikripthi esifana nokulandelayo (sikopishwa kuphela ku- $ home / bin / futhi sinikezwe izimvume zokwenza)


    #!/bin/sh
    # nuevoscript
    if [ $# -eq 0]; then
    DEST=$HOME
    SNAME=script.sh
    elif [ $# -eq 1]; then
    DEST=.
    SNAME="$1"
    else
    echo "Parámetros incorrectos"
    exit -1
    fi
    echo -e '#!/bin/bash\n# -*- ENCODING: UTF-8 -*-' > "$DEST/$SNAME" && \
    chmod +x "$DEST/$SNAME"
    echo "Creado el script $DEST/$SNAME"
    exit 0

    Ngale ndlela, uma ugijima umbhalo omusha ngaphandle kwemingcele, dala $ ikhaya / script.sh, kepha uma isebenza umbhalo omusha omunye umbhalo, kudala ./enye imibhalo

  9.   Amaramu kusho

    Sawubona mngani, ngifisa ukwazi ukuthi ngingayakha kanjani i-autorun ye-sdcard nokuthi ifundwe ngocingo lwami nge-android enje nokuthi uma isetshenziswa ngiqala abd.exe kanye nomyalo bugreport> bugreport.txt

    1.    KZKG ^ Gaara kusho

      Awunamqondo mngani ... Angikaze ngisebenzise i-Android.

  10.   I-Neo61 kusho

    Ngiyabonga uGaara, bengifuna ukuthola indawo lapho ngingafundiswa khona imibhalo ethile, ngicabanga ukuthi nge-imeyili ngishilo lokhu kuwe okuyinto engidinga ukuyifunda. Ngilandele imininingwane oyinikeza imininingwane futhi yonke into iphelele kepha ayisebenzi, ngithola lokhu:

    ./script.sh: umugqa 5: I-EOF engalindelekile ngenkathi kuseshwa ukufana `» '
    ./script.sh: umugqa 9: iphutha le-syntactic: ukuphela kwefayela bekungalindelekile

    Ngichazele ukuthi yini iphutha lami

    1.    KZKG ^ Gaara kusho

      Iphutha lami, i-WordPress ishintsha imininingwane ethile, ibuye ibheke ikhodi eposini bese iyibeka kanjena kuskripthi sakho.
      Okwenzekayo ukuthi:

      "Asd"

      Akufani nokuthi:
      "asd"

  11.   I-Neo61 kusho

    Angiqondi, ngisabona okufanayo. Luphi ushintsho? Ungangichaza kangcono? Manje uma uyikhipha, lo mugqa uyakhipha:
    ./script.sh: umugqa 5: °: Ifayela noma umkhombandlela awukho

    1.    KZKG ^ Gaara kusho

      Ngidlulise umbhalo owusebenzisayo, faka ikhodi lapha: http://paste.desdelinux.net
      Bheka okuthunyelwe futhi, ukuthi bengikhohliwe ukuchofoza inkinobho yokuvuselela 😀

  12.   I-Neo61 kusho

    Sawubona mlingani:
    Ngizokutshela ukuthi bengibheka umbhalo we-conkyrc owenzele i-conky 2010 yakho futhi yebo, kuyiqiniso, uphawu lwediski lungolomthombo obizwa ngePoky kepha awuzi ngokuzenzakalela ku-libreOffice ku-Ubuntu 12.04, kungaba kuhle, uma unalo mthombo , ngitshele lapho ngingayilanda khona (okuthile okunzima, empeleni), into eyodwa engiyibonile ukuthi lapho izinhlamvu zalezi zimpawu zifakwa futhi ifonti ingekho ohlelweni, bese ibeka uhlamvu, hhayi uphawu, Kunengqondo, sengivele ngithola umbono wokuthi konke kusebenza kanjani, kepha ngidinga umuntu ozongichazela izinto ukuze aziqonde kangcono, konke engikwenzayo kudonswa imali futhi angikaze nginikeze noma yiluphi uhlelo, bekungeyona into yesayensi yekhompyutha engikufundile Futhi, bekuphinde kwaba kwesinye isikhathi, ngisebenzisa i-computing njengendlela yokuzilibazisa futhi okuhle ukuthi ngisebenza kwelinye lamagatsha alo, konke engikufundile bekuzifundisile, yingakho intshisekelo yami kumuntu okuthi, noma kancane kancane, Ngiqondise. nangu futhi umbhalo wesigcino sami futhi ngizochaza engingakutholi:

    Bheka, lapho ngizama ukufaka enye i-HDD, ngisayithola efanayo ngoba inika inani lokushisa elifanayo. Angizitholi izici ze-CPU ohlelweni, iphuma (i-NULL) ngokugqamile, lapho ngizama ukufaka ikhalenda oyifaka ku-Conky ukuthi i-tanias ngo-2010 ayihlelekile futhi inweba umugqa we-conky. Bheka ukuze ubone konke ukuthuthuka ongakwenza. Ngiyabuthanda ububanzi enginabo nokuthi ikhalenda lakho livumelana nobobubanzi nokuthi konke engikutshele khona ukuthi akulubonisi kuyaphuma, nakhu kuya:

    http://paste.desdelinux.net/4552

    -Beka ikhodi ekunamathiseleni kwethu, ngakho-ke amazwana awabanzi kangako–

  13.   GONZALO kusho

    iqiniso ukuthi umnikelo wakho uyadabukisa

  14.   edgar kusho

    Sawubona, wenze impilo yami yaba lula ngalo mbhalo. Ngiyabonga kakhulu ngoba ngingathanda ukwazi ukuthi ungangithumelela i-imeyili lapho uyichaza khona ngoba ngiyinhlangano ekuhlelweni.
    Gracias

    1.    KZKG ^ Gaara kusho

      Sawubona,
      Okungcono angikwazanga ukuchaza / ukuchaza le migqa yekhodi, yini ongakuqondanga ukuyichaza ngenye indlela?

      Ngokufanayo, uma ungabaza, ungahlala ubuza esithangamini sethu: forum.desdelinux.net

      Sanibonani

  15.   Cesar kusho

    Umnikelo omuhle kodwa ungawuhlanganisa ... Ngidinga iskripthi se-sai. Okusho ukuthi, lapho uSai ebona ukuthi usebhetri futhi unemizuzu engama-20 ukuthi acime, uthumela isignali kudivayisi futhi lokho kufanele kusebenze iskripthi ukucisha amanye amaseva. Angazi noma ngichaze kahle yini ... iValdria ngokufaka umbhalo wakho othi «shutdown -h» ??

    Siyabonga!

  16.   UJesu israel perales martinez kusho

    Okuthile ongangeza kufolda yami yesifanekiso: B

  17.   edwar kusho

    Ngabe othile angangisiza ngidinga iskripthi se-ubuntu okuthi uma sivala isiphequluli se-chrome, siphinde sisivule

    Ngiyabonga kusengaphambili

  18.   edo kusho

    Ngidinga iskripthi sokuthi nje ngokusisebenzisa sizobhala ngaphezulu imininingwane yefayela ngomunye umbhalo, ngabe kukhona owaziyo ukuthi unjani?

    1.    edo kusho

      Ngivele ngabona ukuthi ngenhla bathi kwenziwa kanjani

  19.   Dario kusho

    Kuhle kakhulu, kuhle kubazukulu bami.
    Ukubonga okuyinkulungwane. »Njengoba nje ungaba nabantu abasha abaningi, abasebenza njengothisha… .kungaba kuhle.

  20.   I-PC yamaRoma kusho

    Ilula futhi isebenza kahle, njengoba kufanele kube njalo.

    Siyabonga ngokwabelana.

    Ukubingelela

  21.   UHernan Jaramillo kusho

    Ngiyabonga ngosizo lwakho. Kwaba wusizo, incazelo enhle kakhulu.

  22.   UVicene kusho

    Ngiyabonga ukuthi kungisebenzisile. Jabulela

  23.   Gamerz kusho

    Ilula futhi iyasebenza. Okokufundisa okuhle kwabasha 🙂

  24.   ULuis Carlos kusho

    Sawubona, ngazi okuncane kakhulu ngemibhalo futhi angazi noma ngabe ngidida imiqondo kepha engizama ukukwenza ekhasini lewebhu elilandelayo:
    http://beginlinux.com/blog/2010/03/iptables-with-network-card-aliases/

    Iqiniso ukuthi angiqondi kahle ukuthi ngingaqala kanjani le khodi noma uma lokhu kungena esikhundleni se-IPTABLES. Futhi uma ithatha indawo yayo ngendlela ebizoba ngayo ukuze iqale ngokuzenzakalela nge-OS.

    Gracias

  25.   Cris kusho

    IGaara ethusayo !!!

    Ngaqala ukwenza umsebenzi wesikole njengoba wawuchaza futhi kwasebenza !! Siyabonga ngokuthatha isikhathi futhi wabelane ngolwazi lwakho lokuphuma ebumnyameni nabangazi.

    (I.

  26.   leo kusho

    Sawubona, nginemibuzo yokwenza umbhalo owenziwe umsebenzisi, ungangisiza?

  27.   abasha kusho

    sawubona nginombuzo ngefayela le-.sh
    unayo indlela yokuthi
    Ngikuthinte ukuze ngibone ukuthi ngikwenza kahle?

    #! / uhlelo / ibin / sh
    ukukhweza -o remount, rw /
    mkdir /mnt/local/Android/data/org.xbmc.xbmc/files/.xbmc
    ln -s /mnt/local/Android/data/org.xbmc.xbmc/files/.xbmc /.xbmc
    ukukhweza -o ukubuyisa, ro /

    , Ngiyisebenzisa ngesandla esigungwini futhi uma isebenza, kepha uma ngifuna ukuthi ifayili isebenze ayifuni.

  28.   ULuix kusho

    Ngithole le kuvivaolinux.com.br, kuhle

    #! / bin / bash

    Kususelwa ku-Gera.sh - Gera cabeçalho yemibhalo

    Ibhalwe ngu: Sandro Marcell P. Barbosa (Boa Vista - Roraima)

    E-mail: sandro_marcell@yahoo.com.br

    I-Slackware GNU / Linux 10.1.0

    Isibonelo sokusetshenziswa: script_name my_script

    Ungacacisa futhi isandiso, ukuhambisana noma utolika.

    Isb.: Nome_script backup.sh for o translate 'sh'

    noma i-nome_script backup.tcl yetolika 'tcl' kanye nosuku!

    Ukuchaza utolika ongakwenza (esikhundleni somunye!):

    UMHUMULUMI = »#! / Bin / sh»

    Okuqukethwe kukanhlokweni (shintsha ngendlela othanda ngayo!):

    ULWAZI = »##»
    UMDALI = »## Ibhalwe ngu:»
    EMAIL = »## Imeyili: wena@correo.com»
    ISITHILI = »##»

    Ukuhlola ukuthi ngabe umsebenzisi ucacisile igama leskripthi:

    uma [$ # -eq 0]; lapho-ke
    i-echo ">>> Ukusetshenziswa: $ (igama lesisekelo $ 0)"
    Phuma
    fi
    uma [$ # -ge 2]; lapho-ke
    nanela "Igama elinezikhala alivumelekile!"
    Phuma
    fi

    Ngabe umsebenzisi angabhalela umkhombandlela wamanje?

    uma [! -w $ PWD]; lapho-ke
    phendula "Ayikho imvume yokubhala umkhombandlela wamanje!"
    Phuma
    fi

    Kuthiwani uma kukhona omunye umbhalo onegama elifanayo enkombeni yamanje?

    uma [-f $ 1]; lapho-ke
    phendula "Umbhalo onegama elifanayo usuvele ukhona kule nkomba!"
    Phuma
    fi

    Umzimba weskripthi:

    (
    ikati << END
    $ UMHUMUSHI

    $ ULWAZI
    $ UMDALI
    $ EMAIL
    $ DISTRO

    Manje engeza imiyalo emigqeni elandelayo =)

    Idethi yokwenziwa kwalo mbhalo: $ (date «+% a% d /% m /% Y») at $ (date «+% T»)

    FIN
    )> $ 1

    Ukusetha ukukhipha imvume:

    uma [-f $ 1]; lapho-ke
    chmod + x $ 1 2> / dev / stdout
    qhosha "Iskripthi $ 1 sidaliwe futhi savunyelwa ukwenza!"
    fi

    Idethi yokudalwa kwalo mbhalo: 29/01/2013 19:45:00

    1.    Mthokozisi kusho

      Kuhle, kusebenza ngokuphelele !!!

  29.   Vicente kusho

    Isifundo esihle kakhulu, esilula futhi singisize kakhulu, ngiyabonga

  30.   UCalichi kusho

    KZKG othandekayo ngingu-newbie, kepha nginentshisekelo yokufunda.
    Unesinye isikhwama. Noma ngokuzumayo endaweni engisebenza kuyo ngifuna ukuvula ehlanganisiwe futhi angiyiboni.
    Noma yimiphi imibono.

  31.   UCalichi kusho

    Ngidinga usizo ngombhalo. Kuhlanganisiwe.

  32.   kuphole9 kusho

    Ngiqondile nge-bash, kepha uma ngifuna ukwenza i-alias ezenzakalelayo ayiphumeli

  33.   angiesarita kusho

    Ngiyabonga kakhulu ngosizo lwakho mngani.

    Ngingathanda ukwazi ukuthi ungangenzela umusa omkhulu yini, ngidinga ukudala iskripthi esingisiza ukudala i-.sum ngesikhathi esithile kepha angazi ukuthi ngiyifaka kanjani ipharamitha. Ungangisiza ngezinkomba ezithile. Ngiyabonga futhi ngizolalela uma ungangisiza.

    Phendula ngokucaphuna

  34.   José kusho

    Sawubona, ntambama, bheka, ngenza umsebenzi kwi-lex, ngakho-ke ngithanda uma ungangisiza ngeSkripthi, engingasebenzisa ngaso lex file, lelo elidala i-lex (lex.yy.c) nefayela lokufaka idatha .

    Muchas Gracias

  35.   UWilmer Ron kusho

    i-watercress ngiyabonga doc !!! Ngimusha kwiskripthi, ngiyabonga kakhulu, ngiyabingelela, ngizoqapha nge-tutoring yakho entsha !!!!

  36.   UKaren vega kusho

    Sawubona!!!

    Ngiyabonga kakhulu ngeminikelo yakho, ngiyaqala ukungena ku-unix futhi kuyaqabukela ukuthi othile achaze le khodi yendawo ngendlela elula kangaka. Ngingathanda ukukubuza ukuthi uma ngenqubo yakho ngingenza iskripthi esingisiza ukuthola inombolo yamafayela ahlala kuleyo ndlela, nokuthi ngiwakopisha kwenye ifolda ... othile wangitshela ukuthi ngingagcina ku-txt indlela negama amafayela wami, kepha akucaci kimi ukuthi ngikwenze kanjani. Ngihlale nginake.

    Saludos !!

  37.   U-Eibar Amaya kusho

    Sawubona ngine-VPS kepha ngidinga usizo kwezinye izinto orita ngokwami ​​nginentshisekelo yokwakha iskripthi noma okuthile ukuze ngisebenzise isipele sakho konke okuphakathi kwefolda yami / yezimpande nokuthi isipele sisebenza njalo ngehora elilodwa uma ungasiza ngokuthi ngingakuthokozela kakhulu kulokho

    Ngikushiya u-facebook wami uma ufuna ukungisiza ngidinga usizo oluningi 🙂

  38.   UJorge Rodriguez kusho

    ngidalele i-ping futhi ngiqaphele imishini ethile yenethiwekhi enkampanini
    kepha ngikwenze kwaba lula

    thinta red.sh && chmod + x red.sh
    uphonse '# -- Ukufaka: UTF-8 -- '>> obomvu.sh
    echo 'ping 10.50.0.125 -w 5' >> red.sh
    echo 'ping 10.50.0.80 -w 5' >> red.sh

    yiqhube ./red.sh futhi kulungile

  39.   Guillermo kusho

    Sawubona, ngidinga ukudala iskripthi sokufaka esizenzakalelayo. Ngizimisele ukukhokhela umsebenzi owenziwe kahle. Labo abanentshisekelo, bangithumelele i-imeyili ku- carranzalh@gmail.com. Ngiyabonga

  40.   sAry kusho

    bangincela iqhude lami XD

  41.   I-Hdexz kusho

    Sawubona mngani, ungangisiza ngokuthile
    Ngidinga ukwenza ibhekhaphu nge-linux yenkampani ngoba iphephile ukuze amagciwane angayibambi kepha angazi ukuthi ngikwenza kanjani
    Ngidinga ukudala iskripthi esizopakisha amafayela siwathumele ku-ftp

    Ngingabonga ngaphambi kwesikhathi bhalela i-imeyili yami

    cesarloscor@gmail.com