BASH/C3/Basics-of-Redirection-(error-handling)/Gujarati
From Script | Spoken-Tutorial
Revision as of 12:48, 6 February 2015 by Jyotisolanki (Talk | contribs)
Title of script: Basics of redirection
Author: Jyoti Solanki
Keywords: Video tutorial, redirection, file descriptors, standard input, standard output, standard error
| Time | Narration |
| 00:01 | Basics of redirection પરનાં સ્પોકન ટ્યુટોરીયલમાં સ્વાગત છે. |
| 00:07 | આ ટ્યુટોરીયલમાં, આપણે શીખીશું |
| 00:10 | બેશમાં ઈનપુટ અને આઉટપુટ |
| 00:12 | રીડાયરેક્શન અને ફાઈલ ડિસ્ક્રીપ્ટર્સ |
| 00:15 | સ્ટાન્ડર્ડ ઈનપુટ |
| 00:16 | સ્ટાન્ડર્ડ આઉટપુટ |
| 00:18 | સ્ટાન્ડર્ડ એરર |
| 00:19 | ઉદાહરણ સાથે સમજીએ. |
| 00:22 | આ ટ્યુટોરીયલનાં અનુસરણ માટે તમને બેશમાંનાં Shell Scripting નું જ્ઞાન હોવું અનિવાર્ય છે. |
| 00:28 | જો નથી, તો સંદર્ભિત ટ્યુટોરીયલો માટે કૃપા કરી દર્શાવેલ અમારી વેબસાઈટનો સંદર્ભ લો, (http://www.spoken-tutorial.org) |
| 00:34 | આ ટ્યુટોરીયલ માટે હું વાપરી રહી છું. |
| 00:36 | ઉબુન્ટુ લીનક્સ 12.04 ઓપરેટીંગ સીસ્ટમ અને |
| 00:40 | GNU BASH આવૃત્તિ 4.2 |
| 00:43 | કૃપા કરી નોંધ લો, આ ટ્યુટોરીયલનાં અભ્યાસ માટે GNU Bash આવૃત્તિ 4 કે તેથી વધુ આગ્રહ કરીએ છીએ. |
| 00:50 | GNU/Linux માં આપણે ફાઈલમાં આઉટપુટ મોકલી શકીએ છીએ અથવા ફાઈલમાં ઈનપુટ વાચી શકે છે. |
| 00:58 | પ્રત્યેક Shell કમાંડને તેની પોતાનું ઈનપુટ અને આઉટપુટ હોય છે. |
| 01:03 | ઈનપુટ અને આઉટપુટના રીડાયરેક્શન કરવા માટે વિશિષ્ઠ નોટેશનનો ઉપયોગ Shell દ્વારા કરવામાં આવે છે. |
| 01:11 | ઈનપુટ અથવા આઉટપુટનો ડીફોલ્ટ પાથ બદલવાને redirection કહેવાય છે. |
| 01:18 | GNU/Linux માં બધુ જ કાઈ ફાઈલ હોય છે, હાર્ડવેર સહિત |
| 01:24 | સામાન્ય રીટર્ન વેલ્યુ આવી હોય છે: |
| 01:27 | ઈનપુટ 0 એટલેકે Keyboard |
| 01:31 | ઈનપુટ 1 એટલેકે Screen |
| 01:34 | Error 2 માટે Screen |
| 01:38 | 0, 1, 2 એ POSIX નંબર છે અને આ file descriptors' (FD) ની જેમ ઓળખાય છે. |
| 01:46 | યુજર અથવા અન્ય પ્રોગ્રામ બોલવામાટે રીડાઇરેક્ટર POSIX નંબર વાપરે છે. |
| 01:54 | સ્ટાન્ડર્ડ ઈનપુટ : સ્ટાન્ડર્ડ ઈનપુટ એ ડીફોલ્ટ ઈનપુટ મેથડ છે. |
| 02:00 | ઈનપુટ વાચવા માટે બધા કમાંડ વાપરવામાં આવે છે. |
| 02:04 | આ (0). દ્વારા સૂચિત કરવામાં આવે |
| 02:07 | તેને stdinb(Standard input). પણ કહેવામાં આવે છે. |
| 02:13 | કીબોર્ડએ ડીફોલ્ટ સ્ટાન્ડર્ડ ઈનપુટ છે. |
| 02:17 | Less than ચિન્હ એ ઈનપુટ રીડાયરેક્શન ચિન્હ છે. |
| 02:22 | સિન્ટેક્સ છે Command space less than symbol space filename |
| 02:30 | ચાલો હું redirection dot sh નામની ફાઈલ ખોલું. |
| 02:34 | મેં આ ફાઈલ માં અમુક કોડ ટાઈપ કર્યા છે. |
| 02:37 | આ shebang line. છે. |
| 02:41 | ટાઈપ કરો ' sort space less than symbol space file dot txt |
| 02:48 | આ ઈનપુટ રીડાયરેક્શનનું ઉદાહરણ છે. |
| 02:52 | file dot txt ફાઈલમાંથી ઈનપુટ લેવામાં આવશે. |
| 02:57 | sort કમાંડ file dot txt માંથી નંબરનું વર્ગીકરણ કરે છે. |
| 03:04 | Save પર ક્લિક કરો. |
| 03:06 | ચાલો redirection dot sh ફાઈલને રન કરો. |
| 03:10 | એક સાથે તમારા કીબોર્ડ પર Ctrl, Alt અને T નો ઉપયોગ કરીને ટર્મિનલ ખોલો. |
| 03:18 | તે પહેલા આપણેfile dot txt માંની વિષયવસ્તુ જોઈએ. |
| 03:23 | ટાઈપ કરો cat space file dot txt. |
| 03:27 | એન્ટર દબાઓ. |
| 03:30 | તમે જોઈ શકો છો કે ફાઈલ માં નંબરો ની શ્રેણી છે. |
| 03:35 | હવે ટાઈપ કરો: chmod space plus x space redirection dot sh |
| 03:43 | Enter. દબાઓ. |
| 03:45 | ટાઈપ કરો dot slash redirection dot sh |
| 03:48 | Enter. દબાઓ. |
| 03:51 | વર્ગીકરણ કર્યા પછીથી આપણે આઉટપુટ ટર્મિનલ પર જોઈ શકીએ છીએ. |
| 03:56 | |
| 04:00 | સ્લાઈડ પર પાછા આઓ. |
| 04:03 | સ્ટાન્ડર્ડ ઈનપુટ: આઉટપુટ ડીસ્લ્પે કરવા માટે બધા કમાંડ દ્વારા વપરાય છે. |
| 04:10 | મૂળભૂત આઉટપુટ સ્ક્રીન પર દ્રશ્યમાન છે. |
| 04:14 | આને (1) નંબરથી સૂચિત કરવામાં આવે |
| 04:17 | આને stdout (Standard output). કહેવાય છે. |
| 04:23 | ( > )Greater than ચિન્હ એ આઉટપુટ રીડાઇરેક્શન ચિન્હ છે. |
| 04:28 | સિન્ટેક્સ છે Command space greater symbol space filename |
| 04:35 | ચાલો હું redirection dot sh ફાઈલ પર જાઉં. |
| 04:41 | પહેલાની લાઈન એટલેકે sort ને કમેન્ટ કરો. |
| 04:45 | તેના નીચે ટાઈપ કરો ls space greater than space ls underscore file.txt |
| 04:55 | આ આઉટપુટ રીડાઇરેક્શન નું ઉદાહરણ છે. |
| 04:59 | 'ls' નું આઉટપુટ ને ls_file dot txt માં વર્ગીકરણ કરવામાં આવશે. |
| 05:06 | ls કમાંડ વિશિષ્ટ ડિરેક્ટરીમાં ફાઈલની માહિતીની યાદી બતાવે છે. |
| 05:14 | હવે ફાઈલ સેવ કરો અને ટર્મિનલ પર જાઓ. |
| 05:19 | ચાલો પહેલા હું પ્રોમ્પ્ટ સાફ કરું. પ્રથમ ચાલો ટાઈપ કરો 'ls' અને આઉટપુટ જુઓ. |
| 05:28 | હવે uparrow કી ને ત્રણ વાર દબાઓ. |
| 05:33 | પહેલાનો કમાંડ dot slash redirection dot sh યાદ કરો. |
| 05:38 | અને એન્ટર દબાઓ. |
| 05:41 | Now let us check whether the output is redirected correctly. |
| 05:46 | Type gedit space ls underscore file dot txt and press Enter. |
| 05:56 | We can now see the output in this file. So our redirect was successful. |
| 06:03 | Come back to our slides. |
| 06:06 | Standard error is the default output error |
| 06:12 | It is used to write all system errors |
| 06:16 | It is denoted by number two (2). |
| 06:20 | Also known as stderr (Standard error). |
| 06:25 | The default standard error output is visible on the screen or monitor. |
| 06:32 | Two greater than symbol (2>) is error redirection symbol |
| 06:36 | Syntax is command space 2 greater than space error dot txt |
| 06:44 | Let me go back to the file redirection dot sh |
| 06:49 | We will comment the previous line. i.e.ls |
| 06:54 | Below it type rm space backslash tmp backslash 4815 dot txt space 2 greater than symbol space error dot txt. |
| 07:11 | The error output is redirected to error dot txt file. |
| 07:17 | Now, Click on Save and switch to the terminal. |
| 07:22 | We will type a command to see the error first. |
| 07:26 | Type rm space backslash tmp backslash 4815 dot txt |
| 07:36 | Press Enter. |
| 07:38 | The error displayed is |
| 07:40 | rm: cannot remove slash tmp slash 4815 dot txt: No such file or directory |
| 07:49 | Now we will execute our file. |
| 07:53 | Press the uparrow key. |
| 07:55 | And, Recall the previous command dot slash redirection dot sh |
| 08:01 | Press Enter. |
| 08:03 | Now let us check whether the error is redirected. |
| 08:07 | Type gedit space error dot txt and press Enter. |
| 08:15 | We can now see the error redirected to file error dot txt. |
| 08:22 | This brings us to the end of this tutorial. |
| 08:26 | Let us summarise. |
| 08:28 | In this tutorial we learnt |
| 08:31 | Input and output in Bash |
| 08:35 | Redirection and file descriptors |
| 08:38 | Standard input using <(less than) symbol |
| 08:42 | Standard output using >(greater than) symbol |
| 08:47 | Standard error using 2> (2 greater than symbol) |
| 08:52 | As an assignment, |
| 08:54 | Write a program in any language like C, C++, Java. |
| 08:59 | And redirect the output or error to a new file. |
| 09:04 | Or, create a text file with some content like your name, address. |
| 09:11 | Redirect the content to a new file. |
| 09:15 | Watch the video available at the link shown below. |
| 09:19 | It summarises the Spoken Tutorial project. |
| 09:23 | If you do not have good bandwidth, you can download and watch it. |
| 09:28 | The Spoken Tutorial Project Team |
| 09:30 | Conducts workshops using spoken tutorials |
| 09:34 | Gives certificates to those who pass an online test |
| 09:38 | For more details, please write to contact@spoken-tutorial.org |
| 09:46 | Spoken Tutorial Project is a part of the Talk to a Teacher project. |
| 09:50 | It is supported by the National Mission on Education through ICT, MHRD, Government of India. |
| 09:58 | More information on this Mission is available at the link shown below. |
| 10:04 | The script has been contributed by FOSSEE and Spoken-Tutorial teams. |
| 10:10 | This is Ashwini from IIT Bombay. Signing off. Thank you for joining |