<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by PratikMurlidharYadav on Medium]]></title>
        <description><![CDATA[Stories by PratikMurlidharYadav on Medium]]></description>
        <link>https://medium.com/@pratikyadav041?source=rss-1a94ede65980------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*4fE9ju5mJ79xK9Uo</url>
            <title>Stories by PratikMurlidharYadav on Medium</title>
            <link>https://medium.com/@pratikyadav041?source=rss-1a94ede65980------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 17:33:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pratikyadav041/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Python-Programming-Day4]]></title>
            <link>https://medium.com/@pratikyadav041/python-programming-day4-472393941fc8?source=rss-1a94ede65980------2</link>
            <guid isPermaLink="false">https://medium.com/p/472393941fc8</guid>
            <dc:creator><![CDATA[PratikMurlidharYadav]]></dc:creator>
            <pubDate>Sat, 01 Feb 2025 19:04:57 GMT</pubDate>
            <atom:updated>2025-02-01T19:04:57.091Z</atom:updated>
            <content:encoded><![CDATA[<p>Object Oriented Programming System(OOPS)</p><p>Object-Oriented Programming(OOP), is all about creating “objects”.</p><p>An object is a group of interrelated variables and functions. These variables are often referred to as properties of the object and functions are referred to as the behavior of the objects. These objects provide a better and clear structure for the program.</p><p>For example</p><p>a car can be an object. If we consider the car as an object then its variables/properties would be — its color, its model, its price, its brand, etc. And its function/behavior would be acceleration, slowing down, gear change.</p><h4>Object-Oriented Programming (OOP) vs Procedure Oriented Programming (POP)</h4><p>The basic difference between OOP and procedural programming is-</p><p>One way to think about POP is the same way you make lemonade for</p><p>example,</p><p>The procedure of making lemonade involves- <br>first taking water according to the need, <br>then adding sugar to the water, <br>then adding lemon juice to the mixture, <br>and finally mixing the whole solution. <br>And your lemonade is ready to serve.</p><p>In a similar way, POP requires a certain procedure of steps. <br>A procedural program consists of functions. <br>This means that in the POP approach the program is divided into functions, which are specific to different tasks. <br>These functions are arranged in a specific sequence and the control of the program flows sequentially.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=472393941fc8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SHELL SCRIPTING-DAY8]]></title>
            <link>https://medium.com/@pratikyadav041/shell-scripting-day8-c0567cb568ce?source=rss-1a94ede65980------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0567cb568ce</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[shell]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[shell-script]]></category>
            <dc:creator><![CDATA[PratikMurlidharYadav]]></dc:creator>
            <pubDate>Wed, 27 Sep 2023 05:42:43 GMT</pubDate>
            <atom:updated>2023-09-27T05:42:43.898Z</atom:updated>
            <content:encoded><![CDATA[<p>Functions in Shell script</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/0*iM57ethTXClhxfhH.jpg" /></figure><p>Shell scripting is a powerful tool for automating tasks and executing commands in a Unix-like environment. One of the key features that makes shell scripting versatile and reusable is the ability to define and use functions. Functions allow you to encapsulate a set of instructions, modularize your code, and enhance the maintainability of your scripts. In this blog post, we will explore the functions in shell scripting in more detail and uncover the benefits they offer.</p><ol><li>Function Basics: In shell scripting, a function is defined in three ways, following are the function declaration syntax :</li></ol><pre>#first way<br><br>function function_name(){<br>  #commands to be executed<br>}<br><br>#second way<br><br>function function_name {<br>    # commands to be executed<br>}<br><br>#Another way<br>function_name(){<br>  ###command to be executed<br>}<br><br><br>#calling a function<br><br>function_name</pre><p>The function name should follow the same naming conventions as variable names in shell scripting (e.g., no spaces, special characters, or starting with a number).</p><p>Here’s an example of a basic function</p><pre>function add() {<br>    echo &quot;add two numbers&quot;<br>    n1=2<br>    n2=3<br><br>    echo &quot;addition of two numbers is $((n1+n2))&quot;<br>}<br><br>add</pre><p>Function with arguments and parameters :</p><p>Here’s an example of a function that calculates the square of a number:</p><pre>square() {<br>    local number=$1<br>    local result=$((number * number))<br>    echo &quot;The square of $number is $result&quot;<br>}<br><br>#Calling a function<br><br>square 2</pre><p>In this example, the square function takes a single argument (number), calculates its square, and echoes the result.</p><p>for more detail about argument kindly check <a href="https://medium.com/@pratikyadav041/shell-scripting-eb492b92318b">SHELL SCRIPTING-Day6</a></p><p>Some use full commands that we can use in program :</p><pre>#!/bin/bash<br><br>if [[ -z $1 ]];<br>then <br>    echo &quot;No parameter passed.&quot;<br>else<br>    echo &quot;Parameter passed = $1&quot;<br>fi</pre><p>The -z flag checks for any NULL or uninitialized variables in BASH. The -z flag returns true if the variable passed is NULL or uninitialized. Hence, we can make use of basic If-else statements to detect the parameters passed.</p><p><strong><em>Thanks for reading!</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0567cb568ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SHELL SCRIPTING-Day7]]></title>
            <link>https://medium.com/@pratikyadav041/shell-scripting-day7-499828c0b0a?source=rss-1a94ede65980------2</link>
            <guid isPermaLink="false">https://medium.com/p/499828c0b0a</guid>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[shell-script]]></category>
            <category><![CDATA[shell]]></category>
            <dc:creator><![CDATA[PratikMurlidharYadav]]></dc:creator>
            <pubDate>Tue, 27 Jun 2023 09:22:02 GMT</pubDate>
            <atom:updated>2023-06-27T09:22:02.324Z</atom:updated>
            <content:encoded><![CDATA[<h4>Loops in shell scripting</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*sZJ5-NUmnbzOy194fDUD6g.jpeg" /></figure><p>In shell scripting, loops allow you to execute a block of code repeatedly until a certain condition is met.</p><p>There are different types of loops available, such as the “for” loop, “while” loop, and “until” loop. Here&#39;s an explanation of how to use each of these loops in a shell script:</p><ol><li>For Loop:</li></ol><p>The for loop allows you to iterate over a list of items and perform actions on each item.</p><p>Here&#39;s the basic syntax of a for loop.</p><p>syntax :</p><pre>for item in list<br>do<br>    # Code to be executed on each iteration<br>done</pre><p>Here’s an example that prints numbers from 1 to 5 using a for loop:</p><pre>for i in 1 2 3 4 5<br>do<br>    echo $i<br>done</pre><p>You can also use variables or command substitutions to generate the list dynamically. For example:</p><pre>for i in {1..5}<br>do<br>    echo $i<br>done</pre><p>This will produce the same result as the previous example.</p><p>2. While Loop:</p><p>The while loop allows you to execute a block of code as long as a certain condition is true. The syntax of a while loop is as follows:</p><pre>while condition<br>do<br>    # Code to be executed<br>done</pre><p>Here’s an example that prints numbers from 1 to 5 using a while loop:</p><pre>counter=1<br>while [ $counter -le 5 ]<br>do<br>    echo $counter<br>    counter=$((counter + 1))<br>done</pre><p>In this example, the loop continues as long as the value of the counter variable is less than or equal to 5. The counter=$((counter + 1)) statement increments the value of the counter variable by 1 in each iteration.</p><p>3. Until Loop:</p><p>The until loop continues executing until a specific condition becomes true.</p><pre>until [ condition ]<br>do<br>    # commands to be executed<br>done</pre><p>Here’s an example that prints numbers from 1 to 5 using an until loop:</p><pre>counter=1<br>until [ $counter -gt 5 ]<br>do<br>    echo $counter<br>    counter=$((counter + 1))<br>done</pre><p>These examples illustrate the basic structure of each loop type. You can modify the loop condition and the commands inside the loop to suit your specific requirements.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=499828c0b0a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python-Programming-Day3]]></title>
            <link>https://medium.com/@pratikyadav041/python-programming-day3-98cf157cdd6b?source=rss-1a94ede65980------2</link>
            <guid isPermaLink="false">https://medium.com/p/98cf157cdd6b</guid>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[PratikMurlidharYadav]]></dc:creator>
            <pubDate>Thu, 15 Jun 2023 11:18:57 GMT</pubDate>
            <atom:updated>2023-07-17T11:42:16.184Z</atom:updated>
            <content:encoded><![CDATA[<h4>Datatypes in Python</h4><p><strong>Datatypes In Python</strong>:</p><p>Python sets the variable type based on the value that is assigned to it. In simple word <strong>datatype is type of value is hold by variable.</strong><br>Variables can hold values, and every value has a data-type. Python is a dynamically typed language, hence we do not need to define the type of the variable while declaring it. The interpreter implicitly binds the value with its type.</p><p>Consider the following example to define the values of different data types and checking its type.</p><pre>a=10 <br>b=&quot;Hi Python&quot; <br>c = 10.5 <br>print(type(a)) <br>print(ptype(b)) <br>print(type(c))</pre><pre>Output:<br>&lt;type &#39;int&#39;&gt;<br>&lt;type &#39;str&#39;&gt;<br>&lt;type &#39;float&#39;&gt;</pre><p>TYPES OF DATATYPES:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*HfRowRGguFfaSeETE7mqMQ.png" /></figure><p><strong>1. FUNDAMENTAL DATATYPES</strong></p><ol><li>Int, float, complex, Boolean, str all are fundamental data type.</li><li>All fundamental data type are immutable(unchangeable).</li><li>Once we create an object we can’t do any changes.</li><li>If we want to do any changes then PVM first to check that is there any objects available with same required data if it is available, then ok otherwise new object will have created.</li><li>Due to this memory management happen and this functionality really help to improve performance of program.</li></ol><p><strong>2. COLLECTION DATATYPE<br></strong>List, tuples, set, frozen set, Dictionary all are collection datatype.</p><p><strong>DATATYPES USE IN PYTHON:</strong></p><p>1. <strong>Numeric Datatype</strong>:</p><p>In Python, numeric data type represents the data which has numeric value.</p><p><strong>Integers </strong>— This value is represented by int class. It contains positive or negative whole numbers (without fraction or decimal). In Python there is no limit to how long an integer value can be. [Size of int is 4 byte]</p><p><strong>Float </strong>— This value is represented by float class. It is a real number with floating point representation. It is specified by a decimal point. Optionally, the character e or E followed by a positive or negative integer may be appended to specify scientific notation.</p><p><strong>Complex Numbers</strong> — Complex number is represented by complex class. It is specified as (real part) + (imaginary part) j. For example — 2+3j.</p><p># Python program to demonstrate numeric value</p><pre>a = 5<br>print(&quot;Type of a: &quot;, type(a)) <br>b = 5.0<br>print(&quot;\nType of b: &quot;, type(b)) <br>c = 2 + 4j<br>print(&quot;\nType of c: &quot;, type(c))</pre><pre>output:<br>Type of a:  &lt;class &#39;int&#39;&gt;<br>Type of b:  &lt;class &#39;float&#39;&gt;<br>Type of c:  &lt;class &#39;complex&#39;&gt;</pre><p><strong>2.</strong> <strong>Sequence Type:</strong></p><p>In Python, sequence is the ordered collection of similar or different data types. Sequences allows to store multiple values in an organized and efficient fashion.</p><p>There are several sequence types in Python — String, List, Tuple</p><p><strong>#Python Program for Creation of String</strong></p><pre># Creating a String   <br># with single Quotes<br>String1 = &#39;Welcome to the My World&#39;  <br>print(&quot;String with the use of Single Quotes: &quot;) <br>print(String1)</pre><p>for More Python check My #Github : <a href="https://github.com/yadavpratik/python-programs.git">https://github.com/yadavpratik/python-programs.git</a></p><p><strong>2. List :<br></strong>A list can be defined as a collection of values or items of different types. The items in the list are separated with the comma (,) and enclosed with the square brackets [].</p><p>feature of list :</p><ol><li>The list are ordered</li><li>The objects of the list can access by index.</li><li>Indexing always start from 0 up to last element present in list.</li><li>The list are mutable type. mutable means we can add, remove, or change the elements present in list.</li><li>The list are growable we can increase or decrease the list by adding or removing elements.</li><li>The list can store all type element like numbers, strings, float value etc. <br>List allows duplicate value.</li></ol><pre>#note:<br>Where to use list:<br>the list can be used in the scenario in which <br>we need to store the simple collection with no constant value.<br>where the elements can be changed.</pre><p>Example: a = [1,2,”Peter”,4.50,”Ricky”,5,6]</p><pre>List = [&quot;pratik&quot;, 23, &quot;yadav&quot;]  <br>print(&quot;\nList containing multiple values: &quot;)  <br>print(List)<br>print(List[0])   <br>print(List[2])</pre><pre>Output :<br>List containing multiple values:<br>[&#39;pratik&#39;, 23, &#39;yadav&#39;]<br>pratik<br>yadav</pre><p><strong>4. Tuple:</strong><br>Python Tuple is used to store the sequence of immutable Python objects. The tuple is similar to lists since the value of the items stored in the list can be changed, whereas the tuple is immutable, and the value of the items stored in the tuple cannot be changed.</p><p>A tuple can be written as the collection of comma-separated (,) values enclosed with the small () brackets. The parentheses are optional but it is good practice to use.</p><p><strong>feature of Tuple:</strong></p><ol><li>Tuple are ordered.</li><li>The element of the tuple can access by index.</li><li>Indexing always start from 0 up to last element present in list.</li><li>The tuple are immutable type. immutable means we can’t add, remove, or change the elements present in tuple.</li><li>The tuple can store all type of element like numbers, strings, float value etc.</li></ol><pre>#note:   Where to use: <br>the tuple can be used in the scenario in which <br>we need to store the simple collection with constant value.<br>where item can’t be changed. </pre><p>Example: T1 = (101, “Peter”, 22) <br>In given example tuple is created with name T1. And elements in <br>small braces () separated by comma (,).</p><pre>T1 = (101, &quot;Peter&quot;, 22)    <br>T2 = (&quot;Apple&quot;, &quot;Banana&quot;, &quot;Orange&quot;)     <br>T3 = 10,20,30,40,50<br>print(type(T1))          <br>print(type(T2))  <br>print(type(T3))</pre><pre>Outout:<br>&lt;class &#39;tuple&#39;&gt;<br>&lt;class &#39;tuple&#39;&gt;<br>&lt;class &#39;tuple&#39;&gt;</pre><p>5. Sets :<br>A Python set is the collection of the unordered items. Each element in the set must be unique, immutable, and the sets remove the duplicate elements. Sets are mutable which means we can modify it after its creation.</p><p>The set can be created by enclosing the comma-separated immutable items with the curly braces {}. Python also provides the set() method, which can be used to create the set by the passed sequence.</p><pre># Creating a set<br>my_set = {1, 2, 3, 4, 5}<br>print(my_set)  # Output: {1, 2, 3, 4, 5}<br><br># Creating a set using the set() constructor<br>my_set = set([1, 2, 3, 4, 5])<br>print(my_set)  # Output: {1, 2, 3, 4, 5}</pre><p>Features of sets :</p><ol><li>Sets are unordered.</li><li>The element of the sets cannot access by index.</li><li>The set are mutable type. immutable means we can’t add, remove, or change the elements present in tuple.</li><li>The set can store all type of element like numbers, strings, float value etc.</li><li>Set doesn’t allows duplicate object.</li></ol><p>6. Dictionary:</p><p>In Python, a dictionary allows you to store and retrieve key-value pairs. It is also known as an associative array or a hash table in other programming languages.</p><p>example :</p><pre># Creating a dictionary<br>person = {<br>    &#39;name&#39;: &#39;John&#39;,<br>    &#39;age&#39;: 30,<br>    &#39;city&#39;: &#39;New York&#39;<br>}<br># Accessing values in a dictionary<br>print(person[&#39;name&#39;])  # Output: John<br>print(person[&#39;age&#39;])   # Output: 30</pre><p>features of Dictionary:</p><ol><li>Dictionaries are mutable, we can modify item by adding, removing, or updating key-value pairs after they are created.</li><li>Dictionaries are unordered collections of key-value pairs. Unlike sequences such as lists or tuples, dictionaries do not maintain any specific order for their elements.</li><li>Each key in a dictionary must be unique. If you attempt to assign multiple values to the same key, the last assigned value will overwrite the previous ones.</li></ol><p>check My Github profile for python Programs : <a href="https://github.com/yadavpratik/python-programs.git">https://github.com/yadavpratik/python-programs.git</a></p><blockquote>Thanks For Reading!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98cf157cdd6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python-Programming-Day2]]></title>
            <link>https://medium.com/@pratikyadav041/python-programming-day2-8581093260a?source=rss-1a94ede65980------2</link>
            <guid isPermaLink="false">https://medium.com/p/8581093260a</guid>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[PratikMurlidharYadav]]></dc:creator>
            <pubDate>Wed, 14 Jun 2023 12:11:25 GMT</pubDate>
            <atom:updated>2023-06-14T12:11:25.476Z</atom:updated>
            <content:encoded><![CDATA[<h4>Lets learn Identifiers, Keywords &amp; Variables</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9eZnmA58HU5uQdX_qwaonw.jpeg" /></figure><p><strong>Identifier in python:</strong></p><ol><li>An identifier is a name given to entities like class, functions, variables, etc. It helps to differentiate one entity from another.</li><li>Variables are the example of identifiers.</li><li>An Identifier is used to identify the literals used in the program.</li></ol><p>The rules to name an identifier are given below:</p><ol><li>Identifiers can be a combination of letters in lowercase (a to z) or uppercase (A to Z) or digits (0 to 9) or an underscore _. Names like myClass”, “var_1” and “print_this_to_screen”, all are valid example.</li><li>An identifier cannot start with a digit. 1variable is invalid, but variable1 is a valid name.</li><li>Keywords cannot be used as identifiers.</li></ol><p>Ex. global = 1 , global is keyword so we can’t use as identifiers.</p><p><strong>Keywords in python:</strong></p><ol><li>Keywords are the reserved words in Python.</li><li>We cannot use a keyword as a variable name, function name or any other identifier.</li><li>They are used to define the syntax and structure of the Python language.</li><li>In Python, keywords are case sensitive.</li><li>There are 33 keywords in Python 3.7. This number can vary slightly over the course of time.</li></ol><p>All the keywords except True, False and None are in lowercase and they must be written as they are.</p><p>The list of all the keywords is given below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*P9mCT7BRyfhnWeb5uKVbnQ.png" /></figure><p><strong>Things to Remember:</strong></p><ol><li>Python is a case-sensitive language. This means, <strong>Variable </strong>and <strong>variable </strong>are not the same.</li><li>Always give the identifiers a name that makes sense. While “c = 10” is a valid name, writing “count = 10” would make more sense, and it would be easier to figure out what it represents when you look at your code after a long gap.</li><li>Multiple words can be separated using an underscore, like “this_is_a_long_variable”.</li></ol><p><strong>Variables in Python:</strong></p><ol><li>Variable is a name that is used to refer to memory location.</li><li>Python variable is also known as an identifier and used to hold value.</li><li>Variable names can be a group of both the letters and digits, but they have to begin with a letter or an underscore.</li><li>It is recommended to use lowercase letters for the variable name. <strong>Rahul </strong>and <strong>rahul </strong>both are two different variables.</li><li>In Python, variables are a symbolic name that is a reference or pointer to an object. The variables are used to denote objects by that name.</li></ol><p>How variable are temporary store the value in memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mHv98VWEDp8pG2gJ.png" /><figcaption>the variable a refers to an integer object.</figcaption></figure><p>Some Examples of variables :</p><pre>name = &quot;Devansh&quot; <br>age = 20 <br>marks = 80.50<br>print(name)<br>print(age) <br>print(marks)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8581093260a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python-Programming-Day1]]></title>
            <link>https://medium.com/@pratikyadav041/python-programming-a4b4dd6a6b50?source=rss-1a94ede65980------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4b4dd6a6b50</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[python-programming]]></category>
            <dc:creator><![CDATA[PratikMurlidharYadav]]></dc:creator>
            <pubDate>Tue, 13 Jun 2023 06:07:31 GMT</pubDate>
            <atom:updated>2023-06-14T12:12:30.852Z</atom:updated>
            <content:encoded><![CDATA[<h4>Lets learn basic of python</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*NOJ9mQaGeBvLUch7B-5NNQ.jpeg" /></figure><p><strong>What is Python?</strong></p><p>Python is a simple, general purpose, high level, and object-oriented programming language. Python is an interpreted scripting language also. Guido Van Rossum is known as the founder of Python programming.· It was created in 1991 and further developed by the Python Software Foundation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*vvsgTJSabRnceV9uqKUZxw.jpeg" /><figcaption>features of python</figcaption></figure><p><strong>How to write basic program in python.</strong></p><pre>#lets write python basic program<br>print(&quot;Hey I have written My first python program&quot;)</pre><pre>#output:<br><br>Hey I have written My first python program</pre><p>In this program, the print() function is used to output the text &quot;Hey I have written My first python program&quot; to the console. When you run this code, you should see the output &quot;Hey I have written My first python program&quot; displayed on the console or terminal.</p><p>Save the code in a file with a .py extension (e.g., first_program.py). Then, you can run the program by opening a terminal or command prompt, navigating to the directory where the file is saved, and executing the following command:</p><pre>py first_program.py</pre><p>OR</p><pre>python3 first_program.py</pre><p><strong>How the script get executed?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*CZjfRXGXNphuUL67zbEDTw.png" /><figcaption>script execution</figcaption></figure><p>The Python interpreter is a program that executes Python code. It starts by tokenizing and parsing the code to create an Abstract Syntax Tree (AST). The AST is then compiled into bytecode, a lower-level representation of the code. The Python Virtual Machine (PVM) interprets the bytecode, executing the instructions one by one. The interpreter handles dynamic typing, memory management, and error handling. It associates objects with variables, manages memory allocation, and raises exceptions when necessary. The interpreter enables the interactive and dynamic nature of Python, making it a powerful and user-friendly programming language.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4b4dd6a6b50" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SHELL SCRIPTING-Day6]]></title>
            <link>https://medium.com/@pratikyadav041/shell-scripting-eb492b92318b?source=rss-1a94ede65980------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb492b92318b</guid>
            <category><![CDATA[shell]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[shell-script]]></category>
            <dc:creator><![CDATA[PratikMurlidharYadav]]></dc:creator>
            <pubDate>Tue, 06 Jun 2023 07:53:01 GMT</pubDate>
            <atom:updated>2023-06-11T13:03:36.539Z</atom:updated>
            <content:encoded><![CDATA[<h3>Command line arguments</h3><p>In shell scripting, you can access command-line arguments passed to the script using special variables. The arguments passed can be accessed using positional parameters represented by $1, $2, $3, and so on. Here&#39;s how you can work with command-line arguments in a shell script:</p><pre>#!/bin/bash<br><br># $0 represents the script name itself<br>echo &quot;Script name: $0&quot;<br><br># $1, $2, $3, ... represent the first, second, third, etc. command-line arguments<br>echo &quot;First argument: $1&quot;<br>echo &quot;Second argument: $2&quot;<br>echo &quot;Third argument: $3&quot;<br><br># $@ represents all the command-line arguments<br>echo &quot;All arguments: $@&quot;<br><br># $# represents the number of command-line arguments<br>echo &quot;Number of arguments: $#&quot;</pre><p>output :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*HidFweJCF3mnkFJ6z3kViQ.png" /></figure><p>In this example, the $0 variable holds the name of the script itself, while $1, $2, and so on represent the command-line arguments passed to the script. The $@ variable represents all the command-line arguments, and $# holds the total count of arguments.</p><p>store the command line arguments in variables :</p><p>o store command-line arguments in variables within a shell script, you can assign them to specific variable names.</p><pre>#!/bin/bash<br><br># Storing command-line arguments in variables<br>arg1=$1<br>arg2=$2<br><br># Using the stored variables<br>echo &quot;First argument: $arg1&quot;<br>echo &quot;Second argument: $arg2&quot;</pre><p>In this script, the command-line argument $1 is assigned to the variable arg1, and $2 is assigned to arg2. You can then use these variables throughout your script for further processing or display purposes</p><p>output :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*MfYz0SheZ1kIqQFgpKu4Tw.png" /></figure><blockquote><strong>Thanks for reading!</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb492b92318b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SHELL SCRIPTING-Day5]]></title>
            <link>https://medium.com/@pratikyadav041/shell-scripting-66e3b224ae9?source=rss-1a94ede65980------2</link>
            <guid isPermaLink="false">https://medium.com/p/66e3b224ae9</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[shell]]></category>
            <category><![CDATA[shell-script]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[PratikMurlidharYadav]]></dc:creator>
            <pubDate>Wed, 31 May 2023 07:04:30 GMT</pubDate>
            <atom:updated>2023-06-11T13:02:37.940Z</atom:updated>
            <content:encoded><![CDATA[<h4>if- esle statment in shell script</h4><p>In shell scripting, conditional statements are used to make decisions and execute different code blocks based on certain conditions. The most commonly used conditional statement in shell scripting is the if statement. Here&#39;s the basic syntax of the if statement:</p><pre>if [ condition ]; then<br>    # Code block to execute if the condition is true<br>else<br>    # Code block to execute if the condition is false<br>fi</pre><ul><li>The condition is an expression that evaluates to either true or false. It can be constructed using various operators and expressions, such as numeric or string comparisons, file tests, or command outputs.</li><li>The then keyword marks the beginning of the code block to execute if the condition is true. It is followed by the statements or commands to be executed.</li><li>The else keyword is optional and marks the beginning of the code block to execute if the condition is false. It is followed by the statements or commands to be executed.</li><li>The fi keyword indicates the end of the if-else statement. It is simply &quot;if&quot; spelled backward.</li></ul><p><strong>some operators using with if else :</strong></p><p><strong>Numeric Comparison Operators:</strong></p><ul><li>-eq: Equal to</li><li>-ne: Not equal to</li><li>-lt: Less than</li><li>-gt: Greater than</li><li>-le: Less than or equal to</li><li>-ge: Greater than or equal to</li></ul><p><strong>String Comparison Operators:</strong></p><ul><li>=: Equal to</li><li>!=: Not equal to</li><li>-z: Empty (zero length)</li><li>-n: Non-empty (non-zero length)</li></ul><p><strong>File Operators:</strong></p><ul><li>-f: File exists and is a regular file</li><li>-d: File exists and is a directory</li><li>-r: File is readable</li><li>-w: File is writable</li><li>-x: File is executable</li></ul><p>Here’s an example that demonstrates the usage of the nested if-else statement:</p><pre>#!/bin/bash<br><br># Check the range of a number<br><br>number=8<br><br>if [ $number -lt 0 ]; then<br>    echo &quot;The number is negative.&quot;<br>elif [ $number -ge 0 ] &amp;&amp; [ $number -le 10 ]; then<br>    echo &quot;The number is between 0 and 10 (inclusive).&quot;<br>else<br>    echo &quot;The number is greater than 10.&quot;<br>fi</pre><p>In this example:</p><ul><li>The first condition [ $number -lt 0 ] checks if the number is less than 0.</li><li>If it is true, the message “The number is negative.” is displayed.</li><li>If not, the next condition [ $number -ge 0 ] &amp;&amp; [ $number -le 10 ] checks if the number is between 0 and 10 (inclusive).</li><li>If this condition is true, the message “The number is between 0 and 10 (inclusive).” is displayed.</li><li>If none of the conditions are true, the code block after else is executed, and the message &quot;The number is greater than 10.&quot; is displayed.</li></ul><p>Besides the if statement, shell scripting also provides other conditional statements, such as case statement for multiple conditional branches and test command for performing complex tests. Additionally, logical operators (&amp;&amp;, ||, !) can be used to combine multiple conditions within the if statement.</p><p>Conditional statements are fundamental in controlling the flow of a shell script based on different conditions and enable you to build more sophisticated scripts.</p><blockquote><strong>Thanks for reading!</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66e3b224ae9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SHELL SCRIPTING-Day4]]></title>
            <link>https://medium.com/@pratikyadav041/shell-scripting-cb7646423530?source=rss-1a94ede65980------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb7646423530</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[shell]]></category>
            <category><![CDATA[shell-script]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[PratikMurlidharYadav]]></dc:creator>
            <pubDate>Wed, 31 May 2023 06:19:54 GMT</pubDate>
            <atom:updated>2023-06-11T15:27:12.637Z</atom:updated>
            <content:encoded><![CDATA[<h4>Types Of Variables :</h4><p>In shell scripting, there are two main types of variables: user-defined variables and system-defined variables.</p><p><strong>User-Defined Variables:</strong></p><p>These variables are defined by the script author to store custom data and values specific to the script. Users can assign values to these variables according to their requirements. Here’s an example of user-defined variables:</p><pre>#!/bin/bash<br><br># User-defined variables<br>name=&quot;John&quot;<br>age=25<br>favoriteColor=&quot;blue&quot;</pre><p>In the above example, name, age, and favoriteColor are user-defined variables that store the name, age, and favorite color of a person.</p><p><strong>System-Defined Variables:</strong></p><p>System-defined variables are predefined by the shell or the operating system. They provide information about the environment, system configuration, and command-line arguments. Here are some common examples of system-defined variables:</p><pre>#!/bin/bash<br><br># System-defined variables<br>echo &quot;Script Name: $0&quot;<br>echo &quot;First Argument: $1&quot;<br>echo &quot;Second Argument: $2&quot;<br>echo &quot;Number of Arguments: $#&quot;<br>echo &quot;Exit Status of Last Command: $?&quot;</pre><p>Here are some commonly used system-defined variables in shell scripts:</p><ol><li>$0: This variable holds the name of the script or the shell itself.</li><li>$1, $2, $3, …: These variables represent the command-line arguments passed to the script. $1 corresponds to the first argument, $2 to the second, and so on.</li><li>$@: This variable represents all the command-line arguments passed to the script as a list.</li><li>$#: This variable stores the number of command-line arguments passed to the script.</li><li>$?: After executing a command, this variable contains the exit status of the most recently executed command. A value of 0 usually indicates success, while non-zero values represent various errors or failures.</li><li>$$: This variable holds the process ID (PID) of the current shell or script.</li><li>$USER: It contains the username of the user running the script.</li><li>$HOME: This variable stores the home directory path of the current user.</li><li>$PWD: It holds the current working directory.</li><li>$PATH: This variable contains a colon-separated list of directories where the shell searches for executable programs.</li><li>$SHELL: It represents the path to the default shell interpreter.</li></ol><h3>Flavors of Variables :</h3><ol><li>String variables:</li></ol><p>These variables store text or string values and alpha-numric value. You can assign values enclosed in single quotes (‘’) or double quotes (“”) to string variables. For example:</p><pre>name=&#39;John&#39;<br>message=&quot;Hello, $name!&quot;<br>username=&quot;pratik123&quot;</pre><p>2. Integer variables:</p><p>Shell scripting does not have native support for integers, but you can work with numeric values as strings. You can use tools like arithmetic expansion or external commands like expr or bc to perform arithmetic operations on these variables. For example.</p><pre>num1=&quot;10&quot;<br>num2=&quot;5&quot;<br>result=$(($num1 + $num2))</pre><p>3. Array variables:</p><p>Arrays allow you to store multiple values in a single variable. You can define an array and access its elements using index numbers. For example:</p><pre>fruits=(&quot;apple&quot; &quot;banana&quot; &quot;orange&quot;)<br>echo &quot;First fruit: ${fruits[0]}&quot;</pre><p>4. Environment variables:</p><p>Shell scripting provides access to various environment variables, which are predefined by the system or the user. These variables contain information about the environment in which the script is running. Examples of common environment variables include:</p><ul><li>$HOME: Represents the user&#39;s home directory.</li><li>$PATH: Specifies the directories to search for executable programs.</li><li>$USER: Stores the username of the current user.</li></ul><p>You can access these variables within your script to retrieve information about the environment.</p><p>5. Positional parameters:</p><p>These variables hold command-line arguments passed to the shell script when it is executed. The first argument is stored in $1, the second in $2, and so on. For example:</p><pre>echo &quot;First argument: $1&quot;</pre><p>6. Special variables:</p><p>Shell scripting provides special variables with predefined meanings. Some commonly used special variables include:</p><ul><li>$0: Represents the name of the script itself.</li><li>$#: Stores the number of arguments passed to the script.</li><li>$?: Holds the exit status of the last command executed.</li><li>$$: Represents the process ID (PID) of the current script.</li></ul><p>These special variables can provide useful information and control within your shell scripts.</p><p>These are the basic types of variables in shell scripting. Understanding and utilizing these variables can help you perform a wide range of tasks within your shell scripts.</p><blockquote><strong>thanks for reading!</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb7646423530" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SHELL SCRIPTING-Day3]]></title>
            <link>https://medium.com/@pratikyadav041/shell-scripting-b02304bda994?source=rss-1a94ede65980------2</link>
            <guid isPermaLink="false">https://medium.com/p/b02304bda994</guid>
            <category><![CDATA[shell]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[shell-script]]></category>
            <dc:creator><![CDATA[PratikMurlidharYadav]]></dc:creator>
            <pubDate>Tue, 30 May 2023 09:02:58 GMT</pubDate>
            <atom:updated>2023-06-11T13:00:53.304Z</atom:updated>
            <content:encoded><![CDATA[<h3>Keywords use in Shell scripting</h3><p><strong>Keywords use in shell scripts :</strong></p><ol><li>if: Used to perform conditional execution based on a condition.</li><li>then: Marks the start of the code block to be executed if the condition in an if statement is true.</li><li>else: Used in conjunction with if to provide an alternative execution path when the condition is not met.</li><li>elif: Used in conjunction with if to provide additional conditional branches.</li><li>fi: Marks the end of an if statement.</li><li>for: Used to create a loop that iterates over a list of values.</li><li>in: Specifies the list of values to iterate over in a for loop.</li><li>while: Used to create a loop that continues until a condition becomes false.</li><li>until: Used to create a loop that continues until a condition becomes true.</li><li>do: Marks the start of a loop body.</li><li>done: Marks the end of a loop.</li><li>case: Allows for multi-way branching based on the value of a variable.</li><li>esac: Marks the end of a case statement.</li><li>function: Used to define a function.</li><li>return: Used to return a value from a function.</li><li>break: Terminates the current loop or switch statement.</li><li>continue: Skips the remaining commands in the current iteration of a loop and moves to the next iteration.</li><li>shift: Shifts the positional parameters to the left.</li><li>export: Sets an environment variable for child processes.</li><li>readonly: Declares a variable as read-only, preventing it from being modified.</li><li>declare: Declares variables and assigns attributes to them.</li><li>local: Declares a local variable within a function.</li><li>eval: Evaluates a command or an expression.</li><li>trap: Sets up signal handling.</li><li>source or .: Executes a script in the current shell environment.</li><li>read: Reads input from the user or from a file.</li><li>echo: Outputs text or variables to the console.</li><li>printf: Formats and prints text.</li><li>test or [ ]: Evaluates a condition or performs comparisons.</li><li>[[ ]]: Provides advanced conditional expressions and string manipulation.</li><li>&amp;&amp;: Executes a command if the previous command succeeded.</li><li>||: Executes a command if the previous command failed.</li><li>:: Null command, does nothing.</li><li>$: Used to reference the value of a variable.</li><li>$$: Represents the process ID of the current script.</li><li>$?: Represents the exit status of the previous command.</li></ol><p>These keywords and constructs provide control flow, conditionals, loops, and variable manipulation capabilities in shell scripting. Remember that the syntax and availability of these keywords may depend on the specific shell you are using, such as Bash, sh, or others.</p><blockquote>thanks for reading!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b02304bda994" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>