BASH/C2/String-and-File-attributes/Khasi
From Script | Spoken-Tutorial
Revision as of 23:26, 31 May 2017 by Meboreen Mary (Talk | contribs)
Time | Narration |
00:01 | Paralok baieid, ngi pdiangsngewbha iaphi sha ka “spoken tutorial” halor ka “String bad file Attributes comparison in Bash.” |
00:10 | Ha kane ka jinghikai, ngin ia pule ia ka: |
00:13 | String comparison bad File attributes comparison. |
00:18 | Ngin ia leh ia kane da kaba pyndonkam katto katne ki nuksa. |
00:22 | Na ka bynta kane ka jinghikai, nga pyndonkam da ka: |
00:25 | Ubuntu Linux 12.04 Operating System bad |
00:30 | Ka GNU BASH version 4.1.10 |
00:34 | Sngewbha kynmaw, ka “GNU Bash” version “4” lane kaba kham shajrong la ai jingmut na ka bynta kane ka jinghikai. |
00:42 | To ngin sdang da ka lamphrang. |
00:45 | Kidon ar tylli ki rukom ban ia nujor ia ka “string” ha ka “Bash”. |
00:49 | 1) Nyngkong: da kaba pyndonkam == (equal to equal to) operator |
00:53 | ban ia nujor ia ar tylli ki “equal strings”. |
00:56 | 2) Ba ar: != (not equal to) operator |
00:59 | Ban ia nujor ia ar tylli ki “not equal strings”. |
01:03 | To ngin ia peit ia ka nuksa. |
01:06 | Nga don hangne ia ka program kaba suk kaba check ia ka “user ID”. |
01:11 | Plie ia ka file ha ka “editor” jong phi bad “save” ia ka kum ka “strcompare dot sh”. |
01:19 | Mynta type ia u code kumba la pyni hangne, ha ka “strcompare dot sh” file. |
01:26 | To ngan batai ia u “code”. |
01:28 | Kane kadei ka “shebang line.” |
01:31 | “whoami” command ka ai ia ka “username” jong u “user” ba mynta. |
01:36 | Ka “if” statement ka check ia ka “output” jong u variable “whoami” pyrshah ia ka “string “root””. |
01:44 | Ngi lah pyndonkam ia u “not-equal to” operator hangne ban ia nujor ia ki strings. |
01:50 | Lada u nongpyndonkam ba mynta um dei u “root user.” Te kan sa “echo” ia kane ka statement- |
01:57 | “You have no permission to run 'strcompare dot sh' as non-root user.” |
02:05 | Hangne, $0 (dollar zero) udei u zeroth argument uba dei hi u 'file-name'. |
02:13 | Lada u nongpyndonkam udei u “root user” kan sa echo - “Welcome root!”. |
02:18 | Nangta ngi don ia ka “exit” statement na ka bynta ka program. |
02:23 | Bad hangne da ka “fi” ngi pynkut ia ka “if statement.” |
02:28 | To ngin ia phai biang sha ki “slides” ban tip kham bun shaphang ka “exit statement.” |
02:34 | Man ka program ka pynphai ia ka “exit status”. |
02:38 | Ka command kaba jop ka pynphai ia u “0” (zero). |
02:42 | Ka command kaba don ka jingbakla kan sa pynphai ia u non-zero “value.” |
02:47 | Ka lah ban ai kum ka “error code”. |
02:51 | Ngi lah ban customize ia u value jong ka “exit statement” ba la pynphai. |
02:56 | Mynta, to ngin “execute” ia ka program. |
02:58 | Plie ia ka “terminal window” da kaba nion “CTRL+Alt” bad “T” keys ha kajuh kapor na ka keyboard jong phi. |
03:08 | Nyngkong, to ngin ia check ia u nongpyndonkam ba mynta jong ka system. |
03:12 | Type: whoami. |
03:15 | Nion “Enter.” |
03:17 | Kane kan sa “output” ia ka kyrteng jong u nongpyndonkam ba mynta. |
03:21 | Mynta ngin pynlong ia ka script jong ngi executable. |
03:25 | Type: chmod + x strcompare dot sh |
03:32 | Type: dot slash strcompare dot sh |
03:37 | Ka “output” kan pyni kum: |
03:39 | You have no permission to run dot slash strcompare dot sh as non-root user. |
03:47 | Mynta to ngin execute ia kajuh ka program kum “root user.” |
03:52 | Type: sudo dot slash strcompare dot sh |
03:58 | Kan sa pan ia u password. |
04:01 | Ai ia u password jong phi hangne. |
04:04 | Ka output kan pyni kum: “Welcome root!.” |
04:08 | Mynta, to ngin pule shaphang ka “file attributes” comparison. |
04:13 | Nga lah don lypa ia ka nuksa jong u code ba donkam. |
04:17 | Ha kane ka program, ngin ia check lada ka file ba la ai kadon ne em. |
04:23 | file1 kadei ka variable ha kaba ngi la save ia ka path jong ka file. |
04:29 | -(hyphen) f command kan check lada ka file kadon ne em. |
04:33 | Bad lada kadei ne em ka file kaba biang. |
04:37 | Lada ka condition kadei True, kan sa echo "File exists and is a normal file" . |
04:44 | Lymda kumta, kan sa echo "File does not exist" . |
04:48 | Phai biang sha ka terminal. To ngin execute ia ka file jong ngi. |
04:53 | Type: chmod plus x fileattrib dot sh |
05:00 | Type: dot slash fileattrib dot sh |
05:05 | Ka output kan pyni kum: |
05:07 | "File exists and is a normal file". |
05:11 | Mynta ngin ia check lada ka file ka thylli ne em |
05:16 | Hashwa ban execute ia ka program jong ngi, ngan shna ia ka file ba thylli kaba kyrteng kum ka empty dot sh. |
05:24 | Type: gedit empty dot sh ampersand sign. |
05:31 | Nion ha “Save”, khang ia ka file. |
05:35 | To ngin ia bujli - (hyphen) f attribute da u - (hyphen) s attribute. |
05:41 | Bujli ia ka kyrteng jong ka file ruh kumjuh. |
05:45 | Type empty dot sh . |
05:47 | Mynta, bujli ia ka “echo statement” ba nyngkong da ka: |
05:51 | “File exists and is not empty” |
05:54 | Bad ka “echo statement” ba ar da ka: |
05:57 | “File is empty”. |
05:59 | Nion ha “Save”. |
06:01 | Phai biang sha ka “terminal”. |
06:03 | To ngan clear ia ka “prompt”. |
06:06 | To ngan “execute”. |
06:08 | Type: dot slash fileattrib dot sh bad shon Enter. |
06:13 | Ka output kadei "File is empty". |
06:17 | Mynta, to ngin ia peit ia kawei pat ka file attribute kaban check ia ka “write permission” jong kano kano ka file. |
06:24 | Phai biang sha ka program jong ngi. |
06:26 | To ngin bujli ia ka - (hyphen) s attribute da ka - (hyphen) w. |
06:32 | Mynta bujli ia ka “echo statement” ba nyngkong da ka: |
06:36 | “User has write permission to this file”. |
06:40 | Bad ia ka “echo statement” ba ar da ka: |
06:43 | “User doesn't have write permission to this file”. |
06:47 | Nion ha “Save”. |
06:49 | Ngan pyndonkam da kawei ka file na ka bynta kane ka nuksa. |
06:53 | Ngan jied ia ka file ka bym dei ka file kaba lah ban pule lane ka bym don ia ka “write permission”. |
07:01 | To ngan pynkylla ia ka “file path” sha ka |
07:04 | “slash etc slash mysql slash debian dot cnf” |
07:10 | Nion ha “Save”. |
07:12 | To ngin “execute” ia ka program jong ngi. |
07:15 | Nion ia u “up-arrow key”. Nion “Enter”. |
07:19 | Ngi iohi ba ka output ka paw kum: |
07:21 | "User doesn't have write permission to this file". |
07:26 | Mynta, to ngin ia peit ia kawei pat ka nuksa kaba shong nongrim ha ka “file attribute”s. |
07:31 | Ha kane ka nuksa, ngin ia check lada ka ‘file1’ kadei kaba kham thymmai ban ia ka ‘file2’. |
07:38 | To ngin ia peit ia ka program. |
07:40 | Kynmaw ba ka kyrteng jong ka file kadei ka fileattrib2 dot sh. |
07:46 | To ngin ia peit mynta ia u “code”. |
07:48 | Hangne ngi don ar tylli ki variables “file1” bad “file2”. |
07:53 | Ki ar tylli ki file lah dep shna lypa bad kidei kiba thylli. |
07:58 | Hangne, ngin ia check lada ka “file1” ka kham thymmai ban ia ka “file2.” |
08:04 | Lada ka “condition” kadei “True”, ngin print “file1 is newer than file2”. |
08:09 | Lymda kumta, "file2 is newer than file1". |
08:14 | Kane kadei kawei pat ka “if statement.” |
08:16 | Hangne ngi check lada ka “file1” ka kham rim ban ia ka “file2.” |
08:21 | Lada ka “condition” kadei “True”, ngi print “file1 is older than file2.” |
08:27 | Lymda kumta, ngin print “file2 is older than file1”. |
08:32 | Phai biang sha ka “terminal” jong ngi. |
08:35 | Nyngkong, ngin ia edit ia ka “empty1 dot sh” file |
08:39 | Ngan shu pyndap ia ka “echo statement” ha ka. |
08:42 | Type: echo within double quotes hiii after the double quotes greater than sign empty one dot sh. Nion Enter. |
08:53 | Mynta, to ngin ia pynlong ia ka “script” executable. |
08:57 | Type: chmod plus x fileattrib2 dot sh. |
09:03 | Mynta , type: dot slash fileattrib2 dot sh. |
09:09 | Ngi iohi ia ka output kum: |
09:11 | file1 is newer than file2 |
09:15 | file2 is older than file1. |
09:19 | Mynta to ngin edit ia ka empty2 dot sh file. |
09:23 | Hangne ruh ngan pyndap ia ka echo statement. |
09:27 | Type: echo hapoh double quotes How are you hadien jong u quotes greater than sign (>)empty2 dot sh. |
09:38 | To ngan clear ia ka “prompt”. |
09:41 | Mynta to ngan “execute” ia ka “script” jong ngi sa shisien. |
09:45 | Nion ia u up-arrow key. |
09:47 | Leit sha ka dot slash fileattrib2 dot sh Shon Enter. |
09:53 | Mynta ka “output” ka paw kum: |
09:55 | "file2 is newer than file1" |
09:59 | Bad "file1 is older than file2". |
10:03 | Da kane ngi lah poi sha kaba kut jong kane ka jinghikai. |
10:06 | To ngan batai kyllum. |
10:08 | Ha kane ka jinghikai, ngi lah pule ia ka |
10:11 | String comparisonfile attributes |
10:14 | ==(equal to equal to) |
10:16 | != (not equal to)* -f (hyphen f) |
10:18 | -s (hyphen s)* -w (hyphen w) |
10:21 | -nt (hyphen nt) bad -ot (hyphen ot) attributes. |
10:25 | Kum ka kam na ka bynta jong phi- wad bniah shuh shuh sa kiwei kiwei ki attributes. |
10:29 | Kum ka nuksa: -r , -x and -o. |
10:33 | Peit ia ka video kaba don ha ka link ba la pyni harum. |
10:36 | Ka batai kyllum ia ka Spoken Tutorial project. |
10:40 | Lada phim don ia ka bandwidth kaba biang, phi lah ban shu download bad peit ia ka hadien. |
10:45 | Ka kynhun jong ka Spoken Tutorial: |
10:47 | Ka pynlong ia ki workshops da kaba pyndonkam da ki spoken tutorials. |
10:51 | Ka ai certificates sha kito kiba pass ha ka online test. |
10:55 | Na ka bynta ki jingtip ba kham bniah, sngewbha thoh sha ka contact@spoken-tutorial.org |
11:02 | Spoken Tutorial project kadei shi bynta jong ka Talk to a Teacher project. |
11:06 | La kyrshan ia ka da ka National Mission on Education lyngba ka ICT, MHRD, Sorkar India. |
11:14 | Kham bun ki jingtip halor kane ka mission kidon ha ka link ba la pyni harum. |
11:19 | Ia kane ka script la noh synniang da ka FOSSEE bad ka kynhun jong ka spoken-tutorial. |
11:25 | Ma nga i Meboreen na Shillong nga pynkut ia kane. |
11:29 | Khublei shibun. |