BASH/C2/Conditional-execution/Khasi

From Script | Spoken-Tutorial
Revision as of 15:56, 3 June 2017 by Meboreen Mary (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Time Narration
00:01 Paralok baieid, ngi pdiangsngewbha ia phi sha ka spoken tutorial halor ka Conditional execution ha Bash.
00:08 Ha kane ka jinghikai, ngin pule shaphang:
00:10 Ka jingdongkam jong ka test command bad
00:13 Conditional statements.
00:15 Ngin leh ia kane da kaba pyndonkam katto katne tylli ki nuksa.
00:19 Ban bud ia kane ka jinghikai
00:21 phi dei ban nang bad tip ia ka Linux Operating System.
00:26 na ka bynta ka jinghikai ba iadei bad kane, sngewbha leit sha ka website jong ngi kumba la pyni
00:32 Na ka bynta kane ka jinghikai, nga pyndonkam:
00:35 Ubuntu Linux 12.04 OS bad
00:39 GNU Bash version 4.1.10
00:43 ka GNU Bash version 4 lane kiba kham shajrong la ai jingmut na ka bynta ka jinghikai
00:49 To ngin sdang da ka lamphrang jong ka test.
00:52 test kadei ka built-in command kaba pynphai ia ka exit status.
00:57 Ka pynphai 0 (zero) na ka bynta True bad 1 (one)na ka bynta False.
01:02 Return value ka shong ha ka jingkhein lane evaluation jong ka expression.
01:07 Lah ban ioh ia ka return status da kaba type Dollar bad question mark sign ($?).
01:14 Ka expression lah ban evaluate ha ki ar rukom
01:18 Kawei kadei- da kaba pyndonkam ia ka keyword test.
01:21 Bad sa kawei pat kadei da kaba pyndonkam ia ka expression ba lah buh hapdeng ki square brackets.
01:27 Mynta, plié ia ka terminal da kaba nion Ctrl+Alt bad T keys ha ka juh kapor.
01:35 Type: test space 4 space hyphen eq space 4 semicolon space echo space dollar sign bad u question mark.Nion Enter.
01:53 Ka pynphai zero kaba mut True.
01:57 4 u ia ryngkat bad 4.
02:00 Nangta , type:
02:02 opening square bracket space 4 space hyphen eq space 4 space closing square bracket semicolon space echo space dollar sign bad u question mark.Nion Enter.
02:22 Ka pynphai zero kaba mut True.
02:25 Kata ka mut 4 u ia ryngkat bad 4.
02:28 To ngin shim sa kawei pat ka expression. Type:

test space 4 space hyphen eq space 5 semicolon space echo space dollar sign question mark. Nion Enter.

02:48 Ka pynphai one kaba mut False.
02:52 Kata kamut 4 kam ia ryngkat bad 5.
02:56 Mynta to ngin thoh ia kajuh ka expression hapoh ki square brackets. Type:
03:01 opening square bracket space 4 space hyphen eq space 5 space closing square bracket semicolon space echo space dollar sign bad u question mark. Nion Enter.
03:21 Ka ruh ka pynphai one kaba mut False.
03:25 Kata ka mut 4 kam ia ryngkat bad 5.
03:29 Kane lah ban pynjrong na ka bynta kawei pat ka test.
03:33 Sngewbha type: man space test bad it ia ka jingdonkam jong ka.
03:40 Mynta, to ngin phai biang sha ki slides jong ngi.
03:43 Mynta ngin ia peit ia ka syntax na ka bynta ka if statement-
03:48 if space opening square bracket space expression space closing square bracket semicolon space then
03:59 Ha ka lain kaba bud , type : commands lane statements kaba phi kwah ban execute.
04:05 Khatduh eh, pynkut ia ka if loop da fi.
04:11 Ki ain ba donkam jong ka condition kidei:
04:14 Barabor buh space hapdeng ki brackets bad ka expression.
04:19 Barabor pynkut ia ka lain da kaba pyndonkam semicolon shwa ka keyword “then”.
04:25 Semicolon la ju pyndonkam ban pynkut ia ka statement lane ka expression.
04:31 Ka long kaba donkam ban quote ia ki string variables lada ngi pyndonkam ia ki ha ka condition.
04:38 Wat klet ban Khang ia ka conditional block da “fi”.
04:43 To ngin peit kawei ka nuksa halor ka if statement.
04:46 Phai biang sha ka terminal jong ngi.
04:49 Ngan plié ia ka script file ba la don lypa kaba kyrteng simpleif.sh.
04:58 Kane ka Bash script ka pyni ia ka khubor “count is 100” haba ka count ka ia ryngkat bad 100.
05:06 Kane ka dei ka lain banyngkong jong ka Bash shell script ba la tip kum ka shebang line.
05:12 U integer 100 la assigned sha u variable count.
05:17 Kynmaw ba ym dei ban don kano kano ka space hapdeng count, = bad 100.
05:24 Kane ka expression ka check lada ka count ka iaryngkat bad hundred.
05:30 Hangne, -eq udei u comparison operator.
05:35 Lada ka condition kadei True, kan pyni ia ka khubor count is 100.
05:41 fi kadei ban pynkut ia ka if block.
05:45 Mynta save ia ka file da kaba nion Ctrl + S.
05:49 Phai biang sha ka Terminal.
05:51 Ban pynlong ia ka file executable ,type: chmod space plus x space simpleif.sh bad nion Enter.
06:04 To ngan clear ia ka prompt.
06:06 Mynta type: dot slash simpleif.sh nion Enter.
06:14 Hangne ka la pyni
06:16 Count is 100.
06:18 Pyrshang ban pynkylla ia u value jong u variable count bad execute ia ka script.
06:24 Mynta phai biang sha ki slides jong ngi.
06:26 Ngin iapeit ia ka if-else condition.
06:30 Ka general syntax kadei: if space opening square bracket space condition space closing square bracket space semicolon space then
06:44 Ha ka lain kaba bud, type commands.
06:47 Ha ka lain kaba bud, don ka else statement.
06:51 Bad sa shisien type sa kiwei ki commands
06:55 Ha ka lain kaba bud, type fi ban pynkut ia ka if block.
07:00 To ngin pule ia ka jingdonkam jong ka if-else bad ka password program kaba sngewtynad
07:06 Phai biang sha ka terminal.
07:09 Ngan plié ia ka file ifelse.sh.
07:14 Kane kadei ka shebang line.
07:17 Hangne, abc123 la buh ha u variable PASS.
07:23 Namar ba abc123 udei u string, dei ban thoh ia u hapoh ki double-quotes.
07:29 Ka read command ka pule ia kawei ka lain jong ka data na ka standard input.
07:35 Ha kane ka bynta, standard input kadei ka keyboard jong ngi.
07:39 Hyphen s kadei na ka bynta ka silent mode
07:43 Kamut ba ka password ba la pyndap kan ym pyni kumba ngi type.
07:48 Ngim kwah ba kiwei kin iohi ia ka password jong ngi.
07:52 Hyphen p kadei na ka bynta prompt.
07:55 Kan sa pyni ia u string “'Enter password: ” shwa ban shim input na u user.
08:01 mypassword udei u variable.
08:04 U buh ia u string, ha kane ka bynta, ka password ba la pyndap da u user.
08:10 Kane ka check ba ka password ba la pyndap ka iahap ne em bad u value jong u variable PASS.
08:17 La buh ia u ha u variable mypassword.
08:21 Lada ka password ka iahap, kan pyni ia ka khubor:
08:25 “Password accepted”
08:27 Lym kumta, kan pyni “Access denied”.
08:31 fi kadei kaba kut jong kaif-else loop.
08:34 Mynta save ia ka file da kaba nion Ctrl, s.
08:38 Phai biang sha ka terminal jong ngi, pynlong ia ka file executable. Type:chmod space plus x space ifelse.sh. Nion Enter.
08:52 Type: dot slash ifelse.sh . Nion Enter.
08:57 Hangne ka la pyni:
08:59 Enter password: Ngan pyndap abc. Nion Enter.
09:05 Namar ba ka password ba la pyndap ka bakla, ka pyni ia ka khubor kum “Access denied”.
09:11 To ngin execute sa shisien, tangba mynta ngin pyndap ia ka password kum abc123.
09:21 Ka la pyni Password accepted.
09:25 Bad da kane ngi la poi sha kaba kut jong kane ka jinghikai.
09:28 Phai biang sha ki slides jong ngi bad batai kyllum.
09:31 Ha kane ka jinghikai, ngi la peit ia ka jingdonkam jong ka test command, simple if statement badif-else statement.
09:41 Kum ka kam na ka bynta jong phi
09:43 Thoh ia ka script, shim ia ka kyrteng jong phi kum ka input.
09:46 Kadei ban check ia kane ka kyrteng bad ka username jong ka system jong phi.
09:51 Lada ka username ka iahap, kadei ban ai khublei ia phi da kaba pyni “Hello”.
09:56 Lym kumta, kadei ban pyni “Try again”.
10:00 HINT: Ka system username jong phi ka don ha u variable $USER.
10:06 Peit ia ka video ba don ha ka link ba la ai harum
10:09 Ka batai kyllum ia ka Spoken-Tutorial project.
10:11 Lada phim don ia ka bandwidth kaba biang , phi lah ban shu download bad peit ia ka .
10:16 Ka kynhun jong ka Spoken-Tutorial Project:
10:18 Ka pynlong ia ki workshops da kaba pyndonkam da ki spoken tutorials
10:22 Ka ai sertiphikate sha kito kiba pass ha ka online test.
10:26 Na ka bynta ki jingtip ba bniah, sngewbha thoh sha ka contact@spoken-tutorial.org
10:33 Spoken Tutorial Projek kadei shibynta jong ka "Talk to a Teacher" projek.
10:37 La kyrshan ia ka da ka National Mission on Education lyngba ka ICT, MHRD, Sorkar India.
10:45 Kham bun ki jingtip halor kane ka mission kidon ha ka link ba la ai harum http://spoken-tutorial.org/NMEICT-Intro
10:51 Kane ka script la noh synniang da ka FOSSEE bad ka kynhun jong ka Spoken-Tutorial .
10:56 Bad nga I Meboreen na Shillong , nga pynkut ia kane.
11:01 Khublei shibun ia ka jingsnohkti lang jong phi.

Contributors and Content Editors

Meboreen Mary