BASH/C2/Conditional-Loops/Khasi

From Script | Spoken-Tutorial
Jump to: navigation, search
Time Narration
00:01 Paralok baieid, ngi pdiangsngewbha ia phi sha ka “spoken tutorial” halor ka “loops” ha ka “BASH”.
00:07 Ha kane ka jinghikai, ngin ia pule ia ka:
00:09 for loop
00:11 while loop
bad katto katne ki nuksa.
00:15 Ban record ia kane ka jinghikai, nga pyndonkam da ka:
00:18 Ubuntu Linux 12.04 Operating System
00:22 GNU BASH version 4.1.10
00:26 Sngewbha kynmaw, ka GNU bash version 4 lane kaba kham shajrong lah ai jingmut na ka bynta kane ka jinghikai.
00:34 To ngin ia sdang ia kane da ka lamphrang sha ki “loops”.
00:37 “Loops” la pyndonkam ban “execute” ia ka group jong ki “statements” bun sien.
00:43 To ngin ia peit ia ka syntax.
00:45 for expression 1, 2, 3
00:49 statement 1, 2, 3
00:51 Bad kane kadei kaba kut jong ka “for loop”.
00:55 Kawei pat ka syntax jong ka “for loop” kadei:
00:58 for variable in sequence/range
01:03 statement 1, 2, 3
01:06 Bad kaba kut jong ka “for loop”.
01:09 To ngin ia peit ia ka nuksa jong ka “for loop” da kaba pyndonkam ia ka syntax ba nyngkong.
01:14 Ha kane ka program, ngin ia kheinlang ia ka sum jong ki “n” numbers ba nyngkong.
01:20 Kynmaw ba ka filename jong ngi kadei ka for.sh.
01:25 Kane kadei ka “shebang line” jong ngi.
01:28 Ka variable “number” kan buh ia ki “value” ba la ai da ki nongpyndonkam.
01:34 Hangne ka value kadei ka integer.
01:37 Mynta, ngi initialise ia ka “variable” “sum” kum zero.
01:42 Kane kadei ha kaba ngi initialise ia ka “for loop.”
01:45 Nyngkong, ngi initialize ‘i’ sha 1.
01:48 Nangta ngi check lada u ‘i’ u duna lane ia ryngkat ia u “number”.
01:54 Mynta hangne, ngi khein ia ka “sum” kum “sum plus i”
02:00 Bad nangta ngi print ia ka.
02:03 Hadien kane, ngi pynkiew ia ka “value” jong u ‘i’ da 1.
02:08 Bad nangta ngi check ia ka “condition” haduh ba kane ka “condition” kan dei “False”.
02:14 Ha kapor ba ngi mih na ka “for loop.” Kane ka khubor kan sa print.
02:19 To ngin “execute” ia ka program bad ngin peit kaei ka ban jia.
02:24 Ha ka “terminal”, type - chmod +x for.sh
02:31 Nangta type: ./for.sh
02:36 Ngan pyndap “5” kum u “input” number.
02:40 Ka “sum” kaba khein lang ia man ki value jong u ‘i’ ka lah paw.
02:46 Hadien kata, ka lain kaba khatduh jong ka “output” ka paw.
02:50 "Sum of first n numbers is 15".
02:54 Mynta, to ngin ia peit ia ka jingiaid jong ka program.
02:57 To ngan resize ia ka “windows”.
03:00 Nyngkong, ngi don ia u value jong ‘i’ kum 1.
03:04 Nangta ngi check lada u “1” u rit ne ia ryngkat bad u “5”.
03:10 Namar ba ka condition kadei “True,” ngi khein ia ka “sum” kum “0 + 1.”
03:16 Mynta ngi don ia ka “sum” kum “1”.
03:20 Nangta ngi print ia ka “sum” kata “1.”
03:24 Hadien kane, ‘i’ lah pynkiew da “1” bad ka value kaba thymmai jong u ‘i’ kadei “2.”
03:31 Nangta ngin check lada u “2” u rit ne ia ryngkat bad u “5”
03:36 Ka “condition” kadei “True” bad mynta ka “sum” kan sa long “1 + 2” kata “3.”
03:44 U ‘i’ u lah shah pynkiew da “1” bad nangta u value uba thymmai jong u ‘i’ udei “3.”
03:51 Bad ngi ioh ia ka “sum” kum “6.”
03:55 Ka “script” kan sa bteng ban pyndap ia u value uba bud jong u ‘i’ bad ka “sum” jong u value ba hashwa.
04:02 Kane kan iai bteng haduh ba u i<=5 un dei False.
04:09 Ha kapor ba ngi mih na ka “for loop,” ka khubor kaba khatduh kan sa print.
04:14 To ngin ia peit ia kawei pat ka nuksa jong ka “for loop” da kaba pyndonkam da ka syntax kaba ar.
04:20 Nga lah thoh ia u “code” ha kane ka file bad nga lah jer kyrteng ia ka kum for-loop.sh.
04:27 Kane ka program kaba suk kan sa lis ia ki files ha ka directory.
04:32 Kane kadei ka “shebang line.”
04:35 Nangta ngi don ia ka “for” loop.
04:37 'ls' command ka list ia ka directory jong ki content.
04:41 -1 (hyphen one) ka lis ia kawei kawei ka file ha kawei kawei ka lain.
04:46 Kane kan sa lis ia baroh ki files kiba don ha ka “home directory” jong ngi.
04:51 Kane kadei kaba kut jong ka “for loop.”
04:53 To ngin ia “execute” ia ka “script” ha ka “terminal” da kaba type-
04:58 chmod +x for-loop.sh
05:04 Type: ./for-loop.sh
05:09 Kane kan pynmih ia baroh ki files kiba don ha ka “Home” directory.
05:14 Mynta ngin ia pule shaphang ka “while loop.”
05:18 To ngin ia pyrshang ban sngewthuh shwa ia ka syntax.
05:21 while condition

statement 1, 2, 3 Bad ka jingkut jong ka while loop.

05:27 Kane ka mut ba ka “while” loop kan sa execute katba ka “condition” ka dang dei “True.”
05:34 To ngin ia peit ia ka nuska jong ka “while loop.”
05:37 Hangne, nga la jer kyrteng ia ka kum ka “while.sh”.
05:42 Ha kane ka program, ngin ia khein lang ia ka sum jong ki even numbers hapoh jong ki range ba la ai.
05:49 To ngin ia iaid lyngba ia u “code”.
05:52 Hangne, ngi pdiang ia u number na u nongpyndonkam bad buh ia u ha u variable “number”.
05:59 Hadien kane, ngi declare ia ki variables ‘i’ bad “sum” bad ngi initialise ia ki haduh u 0 (zero).
06:06 Mynta, kane kadei ka “while” “condition”.
06:08 Hangne, ngi check lada u ‘i’ u less than or equal ia u value jong u number ba la ai da u nongpyndonkam.
06:17 Nangta ngi khein ia ka “sum” da kaba pyndap ia u value jong ‘i’ sha u value jong ka “sum”.
06:24 Hadien kane, ngi ia pynkiew ia u value jong u ‘i’ da “2”.
06:28 Kane kan pynthikna ba ngi pyndap tang da ki even number.
06:33 Bad ka “while loop” ka bteng shi bteng haduh ba u value jong u ‘i’ u tam ia u value jong u “number.”
06:40 Ynda ngi exit na ka “while loop.” Ngin print ia ka sum jong baroh ki even numbers hapoh jong ka range ba la ai.
06:47 To ngin ia “execute” ia ka program.
06:50 Type ha ka “terminal”.
06:52 chmod +x while.sh
06:56 ./while.sh
07:00 Ngan ai “15” kum input jong nga.
07:04 Ka lain ba khatduh jong ka output kadei:
07:06 "Sum of even numbers within the given range is 56".
07:11 To ngan resize ia ka “window” bad batai ia ka “output”.
07:14 Nyngkong ngin check lada u ‘i’ uba dei 0, u rit ne ia ryngkat ia u “number” uba dei “15”.
07:24 Ka “condition” kadei “True.” Te kumta ka “sum” kan dei ‘0+0’ kata 0.
07:31 Mynta ‘i’ un sa shah pynkiew da “2” bad u value ba thymmai jong u ‘i’ udei “2.”
07:37 Nangta ngi check lada u “2” u rit ne ia ryngkat ia u “15”.
07:43 Sa shisien ka condition kadei “True” te ngi pyndap “0+2.”
07:49 Mynta ka “sum” kadon ia u value “2.”
07:52 Sa shisien ka value jong u ‘i’ un sa shah pynkiew da “2”.
07:56 Te, mynta ka value jong u ‘i’ kan dei “2+2” kata “4.”
08:03 Bad ka value kaba bud jong ka “sum” kan dei “4+2” kata “6.”
08:09 Ha kajuh ka rukom, ka “script” kan sa bteng ban pyndap “2” ha ka value kaba hashwa jong u ‘i’, haduh ba un da tam ia u “15”.
08:18 Bad ngi ioh ia ka total value ha ka “sum” kum “56.”
08:24 Da kane ngi lah poi sha kaba kut jong kane ka jinghikai.
08:27 To ngin ia batai kyllum. Ha kane ka jinghikai, ngi lah pule ar tylli ki syntax ba iapher jong ka “for loop” bad ruh ngi la pule shaphang ka “while loop.”
08:37 Kum ka kam na ka bynta jong phi – it ia ka sum jong ki prime numbers ba nyngkong jong u “n”.
08:43 Peit ia ka video kaba don ha ka link ba la ai harum.
08:46 Ka batai kyllum ia ka Spoken-Tutorial project.
08:50 Lada phim don ia ka bandwidth kaba biang, phi lah ban shu download bad peit ia ka hadien.
08:54 Ka kynhun jong ka Spoken Tutorial Project:
08:56 Ka pynlong ia ki workshops da kaba pyndonkam da ki spoken tutorials.
09:00 Ka ai certificates sha kito kiba pass ha ka online test.
09:04 Na ka bynta ki jingtip ba bniah, sngewbha thoh sha ka contact@spoken-tutorial.org
09:11 Spoken Tutorial Project kadei shi bynta jong ka Talk to a Teacher project.
09:14 La kyrshan ia ka da ka National Mission on Education lyngba ka ICT, MHRD, Sorkar India.
09:22 Kham bun ki jingtip halor kane ka mission kidon ha ka link ba lah ai harum.
09:28 Ia kane ka script la noh synniang da ka FOSSEE bad ka kynhun jong ka spoken-tutorial.
09:34 Ma nga i Meboreen na Shillong, nga pynkut ia kane.
09:38 Khublei shibun.

Contributors and Content Editors

Meboreen Mary