Momwe mungayendetse .sh mafayilo

momwe mungagwiritsire ntchito sh file
Dziwani momwe mungayendetsere ndi terminal ndikudina kawiri

ndi mafayilo owonjezera .sh ndi mafayilo omwe ali ndi zolemba, malamulo mu chilankhulo cha bash, omwe amayendera Linux. SH ndi chipolopolo cha Linux chomwe chimauza makompyuta zoyenera kuchita.

Mwanjira ina titha kunena kuti zitha kufanana ndi Windows .exe.

Pali njira zosiyanasiyana zoyendetsera. Ndikufotokozera 2. Imodzi yokhala ndi terminal ndipo inayo ndi mawonekedwe owonetsera, ndiye kuti, ndi mbewa, kuti mukadina kawiri imachitidwa. Mutha kuziwona mu kanemayo ndipo pansipa pali sitepe ndi sitepe kwa iwo omwe amakonda maphunziro achikhalidwe.

Thamangani .sh ndi mawonekedwe owonekera ndi kudina mbewa

Ngati mukufuna kuchita chilichonse ndikudina mbewa, mutha kutero. Kuti igwire ntchito ngati Windows, dinani kawiri pa fayilo ndipo imayamba. Pali njira ziwiri zomwe zikukonzekera mwachangu kwambiri.

Chinthu choyamba ndikusankha kuuza ena kuti fayilo ndiyotheka

Pitani pomwe fayiloyo ilili ndikudina batani lamanja. Menyu idzawonetsedwa ndikupatsa katundu

Tumizani ku mndandanda wathu wamakalata

dinani pomwepa pa fayilo ya .sh

Mumasankha cheke cha Lolani fayilo kuti igwire. Mwanjira imeneyi timapereka zilolezo zakuphedwa

perekani zilolezo zakupha

Titha kutenga mwayi pakusintha tsambalo Tsegulani ndi, yomwe ndi pulogalamu yomwe timasankha kuti isasinthike kwa Epulo, ngati m'malo mowachita tikufuna kuwatsegula ndikuwona zomwe ali nazo. Ndimagwiritsa ntchito Gedit kapena Visual Studio Code

Kenako tiyenera kukonza fayilo manager

Pomaliza mu fayilo manager pitani ku menyu ndikusankha zokonda ndi tabu Khalidwe ndipo pamenepo mutha kudziwa zomwe mukufuna kuchita ndi fayilo.

zokonda za oyang'anira mafayilo

Pali njira zingapo. Tsegulani fayilo, yendetsani kapena mutifunse. Ndasankha kutifunsa. Ndipo chifukwa chake adzawonetsedwa kwa ife.

thamanga sh ndikudina kawiri

Kuthamanga .sh ndi terminal

Timatsegula ma terminal, ndi Ctrl + Alt + T, poyambira kiyi ndikulemba terminal kapena ndi chithunzi cha chipolopolo chomwe ndimakhala nacho nthawi zonse mu Launcher ya Ubuntu, bwerani, kudera lakumanzere.

Njira yoyendetsera izi ndikupita kumalo omwe kuli fayiloyo. ingoganizirani tili ndi fayilo ya ok.sh mu / scripts / folder

Timalowa zolemba (muyenera kupita njira yomwe muli nayo)

cd zolemba

Ngati iyi ndi nthawi yoyamba kuyendetsa, tiyenera kupatsa chilolezo mafayilo

sudo chmod + x ok.sh

Ndiyeno timayendetsa

./ok.sh

Ndipo voila ndi izi

kuthamanga sh mu terminal

Kwa ife, "Ok" amatuluka chifukwa talowetsa zomwe script imachita.

Chofunikira kwambiri komanso zomwe anthu amalakwitsa kwambiri ndi panjira, panjira, posafikira chikwatu pomwe fayilo yoti ichitidwe ili.

Ngati muli ndi mafunso, siyani ndemanga.

Zowonjezera ngati mukufuna kuphunzira

Zinthu zazing'ono ngati mukufuna kuphunzira. Pali malamulo ambiri othamanga a .sh omwe mungachite

./file.sh ndi. ikuwonetsa kuti fayilo ili m'ndandanda wamakono, ngati simungathe kuyendetsa ndi njira yopita ku file path / to / file.sh

Lamulo lina loyendetsa kuphatikiza pa ./sh fayilo ndi

sh fayilo sh

Kusiya ndemanga