Difference between revisions of "BASH/C2/Command-Line-arguments-and-Quoting/Gujarati"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with " {|Border = 1 | '''Time''' | '''Narration''' |- | 00:01 | ''' Command line arguments and Quoting in BASH''' પરનાં આ સ્પોકન ટ્યુટોરી...")
 
Line 230: Line 230:
 
|-
 
|-
 
| 04:07
 
| 04:07
| Now we need to give 12 or 13 '''arguments''' to the program.
+
| હવે આપણને પ્રોગ્રામમા 12 અથવા 13 આર્ગ્યુમેન્ટસ આપવાની જરૂર છે.
  
 
|-
 
|-
 
|04:12
 
|04:12
| Hence Type '''dot slash arg.sh space 1 to 13''' Now press enter
+
| તેથી ટાઈપ કરો  '''dot slash arg.sh space 1 to 13''' હવે એન્ટર દબાઓ.
  
 
|-
 
|-
 
|04:23
 
|04:23
|You can see that the 12th''' argument''' is '''12.'''
+
| ''' argument''' is તમે જોઈ શકો છો કે 12મી આર્ગ્યુમેન્ટ '''12.''' છે.
  
 
|-
 
|-
 
| 04:27
 
| 04:27
| Come back to our editor.
+
| આપણા એડિટર પર પાછા આવીએ.
  
 
|-
 
|-
 
| 04:30
 
| 04:30
|And type the line as shown here.
+
|અને અહી બતાવ્યા પ્રમાણે લાઈન ટાઈપ કરો.
  
 
|-
 
|-
 
| 04:34
 
| 04:34
| '''$# (Dollar hash)''' gives the total number of '''arguments''' that have been passed to a program.
+
| '''$# (Dollar hash)''' આ પ્રોગ્રામમાં પસાર કરેલી કુલ આર્ગ્યુમેન્ટસ ની સંખ્યા આપે છે.  
  
 
|-
 
|-
 
| 04:40
 
| 04:40
| Now click on '''Save.'''
+
| હવે '''Save.''' પર ક્લિક કરો.
 +
 
 
|-
 
|-
 
| 04:43
 
| 04:43
|Let us execute.
+
| ચાલો એક્ઝીક્યુટ કરીએ.
  
 
|-
 
|-
 
| 04:44
 
| 04:44
| Switch to the terminal.
+
| ટર્મિનલ પર જાવ.
  
 
|-
 
|-
 
| 04:46
 
| 04:46
| Let us execute. Press the uparrow key and press '''Enter.'''
+
| ચાલો એક્ઝીક્યુટ કરીએ.અપ એરો કી દબાઓ અને '''Enter.''' દબાઓ.
  
 
|-
 
|-
 
| 04:52
 
| 04:52
|We can see that the total '''arguments''' are '''13.'''
+
| આપણે જોઈ શકીએ છીએ કે કુલ આર્ગ્યુમેન્ટસ  '''13.''' છે.
  
 
|-
 
|-
 
| 04:57
 
| 04:57
|Now switch to the editor.
+
| હવે એડિટર પર જાવ.
  
 
|-
 
|-
 
| 05:00
 
| 05:00
|Press '''Enter''' and '''type''' the lines as shown here.
+
|હવે  '''Enter''' દબાઓ અને અહી બતાવ્યા પ્રમાણે લાઈન ટાઈપ કરો.  
  
 
|-
 
|-
 
| 05:04
 
| 05:04
| '''$* (Dollar asterix)''' will print all the '''arguments''' on a '''''single line'''. ''
+
| '''$* (Dollar asterix)''' તમામ આર્ગ્યુમેન્ટને એકલ લાઈન પર પ્રિન્ટ કરશે.  
  
 
|-
 
|-
 
| 05:10
 
| 05:10
| We will test this with the help of a simple''' for '''loop.
+
| આપણે આને સાદા ''' for '''લૂપની મદદથી ચકાશીશું.
  
 
|-
 
|-
 
| 05:14
 
| 05:14
| We will analyse this '''for '''loop at the time of execution.
+
| આપણે આને '''for '''લૂપને એક્ઝેક્યુશન દર્મ્યાન  વિશ્લેષણ કરીશું.
  
 
|-
 
|-
 
| 05:18
 
| 05:18
| Now click on '''Save.'''Switch to the terminal.
+
| હવે  '''Save.''' પર ક્લિક કરો ટર્મિનલ પર જાવ.
  
 
|-
 
|-
 
|05:22
 
|05:22
| Let me clear the prompt.
+
| ચાલો હું પ્રોમ્પ્ટ સાફ કરું.
  
 
|-
 
|-
 
| 05:26
 
| 05:26
| Now let us type, '''dot slash arg.sh space sunday monday and tuesday'''
+
| ચાલો હવે ટાઈપ કરો, '''dot slash arg.sh space sunday monday અને  tuesday'''
  
 
|-
 
|-
 
| 05:35
 
| 05:35
| Press''' Enter'''
+
| ''' Enter''' દબાઓ.
  
 
|-
 
|-
 
| 05:38
 
| 05:38
| You can see that the total number of '''arguments''' are '''3''' as we have passed 3 '''arguments''' to our program.
+
| તમે જોઈ શકો છો કે કુલ આર્ગ્યુમેન્ટસ ની સંખ્યા '''3''' છે કારણકે આપણે આપણા પ્રોગ્રામમાં '''3''' આર્ગ્યુમેન્ટસ પસાર કરી છે.
  
 
|-
 
|-
 
| 05:46
 
| 05:46
|As already said '''$*''' will print all the '''arguments''' on a single line.
+
| જેવું કે પહેલા બતાવ્યું હતું '''$*''' તમામ આર્ગ્યુમેન્ટસને એકલ લાઈન પર પ્રિન્ટ કરે છે.
  
 
|-
 
|-
 
| 05:54
 
| 05:54
| And this is the output for the '''for loop.'''
+
| અને  '''for loop.''' માટે આ આઉટપુટ છે.
  
 
|-
 
|-
 
| 05:57
 
| 05:57
| We see that''' '''all the '''arguments''' are printed on the '''''single line'''.''
+
| આપણે જોઈ શકીએ છીએ તમામ આર્ગ્યુમેન્ટસ એકલ લાઈન પર પ્રિન્ટ થાય છે.
  
 
|-
 
|-
 
| 06:02
 
| 06:02
| Now move back to our program and '''type''' the lines as shown here.
+
| હવે આપણે પ્રોગ્રામ પર પાછા આવીએ અને અહી બતાવ્યા પ્રમાણે લાઈન ટાઈપ કરીએ.
  
 
|-
 
|-
 
| 06:09
 
| 06:09
| '''$@ (Dollar at)''' will also print all the '''arguments'''.  
+
| '''$@ (Dollar at)''' પણ તમામ આર્ગ્યુમેન્ટ પ્રિન્ટ કરશે.  
  
 
|-
 
|-
 
| 06:13
 
| 06:13
| However, this time each '''argument''' will be printed on  '''separate line'''.
+
| જયારે કે આ વખતે દરેક આર્ગ્યુમેન્ટ જુદી જુદી લાઓઇન પર પ્રિન્ટ થશે.
  
 
|-
 
|-
 
| 06:20
 
| 06:20
| This is another '''for''' loop, which will print each '''argument''' in a separate line.
+
| આ બીજું એક '''for''' લૂપ છે,જે દરેક આર્ગ્યુમેન્ટને  જુદી જુદી લાઈન પર પ્રિન્ટ કરશે.
  
 
|-
 
|-
 
| 06:26
 
| 06:26
| Let us see how. Click on '''Save'''
+
| ચાલો જોઈએ કેવી રીતે '''Save''' પર ક્લિક કરીએ.
  
 
|-
 
|-

Revision as of 12:59, 22 December 2014

Time Narration
00:01 Command line arguments and Quoting in BASH પરનાં આ સ્પોકન ટ્યુટોરીયલમાં સ્વાગત છે.
00:08 આ ટ્યુટોરીયલમાં, આપણે આપેલ વિશે શીખીશું,
00:11 * Command line Arguments અને
00:13 * Quoting
00:15 આ ટ્યુટોરીયલનાં અનુસરણ માટે તમે Linux Operating System થી પરિચિત હોવા જોઈએ
00:20 જો નથી, તો સંબંધિત ટ્યુટોરિયલ્સ માટે આપેલ અમારી વેબસાઈટની મુલાકાત લો.
00:26 આ ટ્યુટોરીયલ માટે, હું વાપરી રહ્યી છું,
00:29 * ઉબ્નટુ લીનક્સ 12.04 OS
00:33 * GNU Bash આવૃત્તિ 4.1.10
00:37 પ્રેક્ટીસ માટે GNU Bash આવૃત્તિ 4 અથવા તેથી વધુનો આગ્રહ કરીએ છીએ.
00:43 * Shell script આર્ગ્યુમેન્ટસ કમાંડ લાઈન થી સ્વીકારી શકાય છે.
00:46 * પ્રોગ્રામમાં પસાર કરેલ આર્ગ્યુમેન્ટને કોલ કરાય છે.
00:52 * એક પ્રોગ્રામમાં કેટલી પણ આર્ગ્યુમેન્ટસ પસાર કરી શકાય છે.
00:57 તમારા કીબોર્ડ પર Ctrl Alt અને T કી એક સાથે દાબીને ટર્મિનલ ખોલો.
01:06 મેં કોડ arg.sh નામની ફાઈલમાં પહેલાથી જ લખી દીધો છે.
01:12 ટર્મિનલ પર, ચાલો હું આ ફાઈલ ખોલું તે માટે ટાઈપ કરો.
01:16 gedit સ્પેસ arg.sh સ્પેસ ampersand ચિન્હ
01:23 આપણે એમ્પરસેન્ડનો ઉપયોગ પ્રોમ્પ્ટને સાફ કરવા માટે કરીએ છીએ.
01:27 હવે Enter. દબાઓ.
01:૩૦ ટેક્સ્ટ એડિટર ખુલે છે.
01:33 ચાલો હું અત્યારે કોડ સમજાઉ.
01:36 shenbang લાઈન છે.
01:39 આ લાઈન Zeroth આર્ગ્યુમેન્ટ પ્રિન્ટ કરશે.
01:43 અહી $0 (Dollar zero) શેલ સ્ક્રિપ્ટીંગનું નામ પ્રિન્ટ કરશે.
01:48 પરિણામ સ્વરૂપે આનો અર્થ એ છે કે, zeroth આર્ગ્યુમેન્ટ એ જાતે જ પ્રોગ્રામનું નામ છે.
01:55 ચાલો પ્રોગ્રામ એક્ઝીક્યુટ કરીને જોઈએ.
01:59 ટર્મિનલ પર જાવ.
02:01 સૌ પ્રથમ ફાઈલને એક્ઝિક્યુટેબલ બનાવો તે માટે ટાઈપ કરો,
02:05 chmod સ્પેસ plus x સ્પેસ arg.sh
02:12 Enter દબાઓ.
02:14 હવે ટાઈપ કરો dot slash arg.sh
02:18 Enter દબાઓ.
02:19 આઉટપુટ આપેલ પ્રમાણે દ્રશ્યમાન થાય છે: Zeroth argument is arg.sh
02:26 હવે આપણા એડિટર પર પાછા આવીએ અને અહી બતાવ્યા પ્રમાણે ત્રણ લાઈનો ટાઈપ કરીએ.
02:33 $1 (Dollar one) આ પહેલી આર્ગ્યુમેન્ટ રજુ કરે છે જે કમાંડ લાઈન પરથી પ્રોગ્રામમાં પસાર કરી છે.
02:40 $2 (Dollar two) પ્રોગ્રામમાં પસાર કરેલ બીજી આર્ગ્યુમેન્ટને રજુ કરે છે.
02:44 અને $3 (Dollar three) ત્રીજી આર્ગ્યુમેન્ટ રજુ કરે છે.
02:48 હવે Save પર ક્લિક કરો.
02:49 ચાલો પ્રોગ્રામ એક્ઝીક્યુટ કરીને જોઈએ.
02:52 ઉપરનું બાણ દર્શાવતી કીને દબાઓ Enter દબાઓ.
02:57 આપણે જોઈ શકીએ છીએ કે zeroeth આર્ગ્યુમેન્ટ પ્રિન્ટ થઇ છે.
03:00 પરંતુ પહેલી, બીજી અને ત્રીજી આર્ગ્યુમેન્ટસ ખાલી છે.
03:05 આ એટલા માટે કારણકે એક્ઝીક્યુટ પ્રક્રિયા દરમિયાન કમાંડ લાઈન આર્ગ્યુમેન્ટસ આપયી હતી.
03:11 તેથી અપએરો કી દબાઓ અને ટાઈપ કરો : sunday monday અને tuesday.
03:18 Enter દબાઓ
03:21 તમે જોઈ શકો છો કે પહેલી બીજી અને ત્રીજી આર્ગ્યુમેન્ટ આ Sunday Monday અને Tuesday છે.
03:28 હવે આપણા એડિટર પર પાછા જાવ Enter દબાઓ.
03:33 હવે અહી બતાવ્યા પ્રમાણે લાઈન ટાઈપ કરો.
03:37 $12 (Dollar twelve) twelveth આર્ગ્યુમેન્ટ રજુ કરે છે.
03:41 9, કરતા મોટી આર્ગ્યુમેન્ટસ લખવા માટે,આપણે છગડીયા કૌંસ વાપરવા પડે છે.
03:46 નહિતર બેશ ફક્ત દશાંશ સ્થાનના ઇનટીજરની આર્ગ્યુમેન્ટ લે શે.
03:53 અને તમને જોઈતું આઉટપુટ મળશે નહી.
03:57 હવે Save. પર ક્લિક કરો.
03:59 Let us execute the program. ચાલો પ્રોગ્રામ એક્ઝીક્યુટ કરીએ.
04:01 terminal. ટર્મિનલ પર જાઓ.
04:04 prompt. ચાલો હું પ્રોમ્પ્ટ સાફ કરું.
04:07 હવે આપણને પ્રોગ્રામમા 12 અથવા 13 આર્ગ્યુમેન્ટસ આપવાની જરૂર છે.
04:12 તેથી ટાઈપ કરો dot slash arg.sh space 1 to 13 હવે એન્ટર દબાઓ.
04:23 argument is તમે જોઈ શકો છો કે 12મી આર્ગ્યુમેન્ટ 12. છે.
04:27 આપણા એડિટર પર પાછા આવીએ.
04:30 અને અહી બતાવ્યા પ્રમાણે લાઈન ટાઈપ કરો.
04:34 $# (Dollar hash) આ પ્રોગ્રામમાં પસાર કરેલી કુલ આર્ગ્યુમેન્ટસ ની સંખ્યા આપે છે.
04:40 હવે Save. પર ક્લિક કરો.
04:43 ચાલો એક્ઝીક્યુટ કરીએ.
04:44 ટર્મિનલ પર જાવ.
04:46 ચાલો એક્ઝીક્યુટ કરીએ.અપ એરો કી દબાઓ અને Enter. દબાઓ.
04:52 આપણે જોઈ શકીએ છીએ કે કુલ આર્ગ્યુમેન્ટસ 13. છે.
04:57 હવે એડિટર પર જાવ.
05:00 હવે Enter દબાઓ અને અહી બતાવ્યા પ્રમાણે લાઈન ટાઈપ કરો.
05:04 $* (Dollar asterix) તમામ આર્ગ્યુમેન્ટને એકલ લાઈન પર પ્રિન્ટ કરશે.
05:10 આપણે આને સાદા for લૂપની મદદથી ચકાશીશું.
05:14 આપણે આને for લૂપને એક્ઝેક્યુશન દર્મ્યાન વિશ્લેષણ કરીશું.
05:18 હવે Save. પર ક્લિક કરો ટર્મિનલ પર જાવ.
05:22 ચાલો હું પ્રોમ્પ્ટ સાફ કરું.
05:26 ચાલો હવે ટાઈપ કરો, dot slash arg.sh space sunday monday અને tuesday
05:35 Enter દબાઓ.
05:38 તમે જોઈ શકો છો કે કુલ આર્ગ્યુમેન્ટસ ની સંખ્યા 3 છે કારણકે આપણે આપણા પ્રોગ્રામમાં 3 આર્ગ્યુમેન્ટસ પસાર કરી છે.
05:46 જેવું કે પહેલા બતાવ્યું હતું $* તમામ આર્ગ્યુમેન્ટસને એકલ લાઈન પર પ્રિન્ટ કરે છે.
05:54 અને for loop. માટે આ આઉટપુટ છે.
05:57 આપણે જોઈ શકીએ છીએ તમામ આર્ગ્યુમેન્ટસ એકલ લાઈન પર પ્રિન્ટ થાય છે.
06:02 હવે આપણે પ્રોગ્રામ પર પાછા આવીએ અને અહી બતાવ્યા પ્રમાણે લાઈન ટાઈપ કરીએ.
06:09 $@ (Dollar at) પણ તમામ આર્ગ્યુમેન્ટ પ્રિન્ટ કરશે.
06:13 જયારે કે આ વખતે દરેક આર્ગ્યુમેન્ટ જુદી જુદી લાઓઇન પર પ્રિન્ટ થશે.
06:20 આ બીજું એક for લૂપ છે,જે દરેક આર્ગ્યુમેન્ટને જુદી જુદી લાઈન પર પ્રિન્ટ કરશે.
06:26 ચાલો જોઈએ કેવી રીતે Save પર ક્લિક કરીએ.
06:29 Switch to the terminal.
06:32 Press the uparrow key.
06:34 Press Enter You can see the difference now.
06:39 These are the arguments printed by $@.
06:43 $@ prints each argument on separate line.
06:47 This is the output for the 2nd for loop.
06:52 Now lets move on to quoting in BASH
06:55 Switch to the slides.
06:57 There are three types of quotes
06:59 Double quote
07:00 Single quote
07:02 Backslash
07:03 * Double quote substitutes the value of variables and commands
07:09 * Example echo “Username is $USER”
07:13 * It displays your username of the system.
07:17 Switch to the Terminal.
07:20 Let me clear the prompt.
07:23 Now type echo space within double quotes Username space is dollar USER in capitals.
07:34 Press Enter
07:35 The username of the system is printed.
07:39 The output will vary according to your system.
07:42 Now move back to slides.
07:46 * Single quotes preserves the literal meaning of each character of the given string.
07:53 * It is used to turn off special meaning of all characters.
07:58 Switch to the Terminal.
08:01 Type echo space within single quote Username is dollar USER in capital
08:10 Press Enter
08:12 The output is Username is $USER
08:16 In this example, it prints all the characters which appear within the single quotes.
08:23 It does not substitute the value of variable $USER
08:28 Switch back to our slides.
08:31 * Backslash removes the special meaning from a single character
08:37 * It is used as an escape character in BASH
08:42 Switch to the Terminal.
08:44 Now Type echo space within double quote Username is backslash dollar USER (in capital)
08:55 Since we have given double quotes, we expect the echo command to display the username.
09:02 Let's try this command so press Enter.
09:06 The output is Username is $USER
09:10 In this example the backslash removes the special meaning of (Dollar) $ symbol.
09:16 $USER is just treated as a string without any special functionality.
09:22 This brings us to the end of this tutorial.
09:25 Switch back to our slides.
09:27 Let us summarize.
09:28 In this tutorial we learnt,
09:31 * Command line arguments
09:33 * Functionality of Double quote, Single quote and Backslash
09:39 Watch the video available at the link shown below
09:42 It summarises the Spoken Tutorial project
09:45 If you do not have good bandwidth, you can download and watch it
09:51 The Spoken Tutorial Project Team Conducts workshops using spoken tutorials
09:56 Gives certificates to those who pass an online test
10:00 For more details, please write to contact@spoken-tutorial.org
10:07 Spoken Tutorial Project is a part of the Talk to a Teacher project
10:10 It is supported by the National Mission on Education through ICT, MHRD, Government of India

More information on this Mission is available at: http://spoken-tutorial.org\NMEICT-Intro

10:24 The script has been contributed by FOSSEE and spoken-tutorial Team.
10:30 And this is Ashwini Patil from IIT Bombay signing off. Thank you for joining.

Contributors and Content Editors

Jyotisolanki, PoojaMoolya