Thursday, November 10, 2022

Shell Scripting By Udemy

 echo $SHELL   

chsh -s /bin/bash

Class 02 [ Shells vs Scripts ]

  • What is the Bash shell is 
    •  A "Program" that "interprets" the commands you type in your terminal and "passes" them on to the "Operating System".

    • BASH = Bourne Again Shell
    • Based on the Bourne Shell (sh), Created by Stephen Bourne in 1979.
    • its feature-rich.
    • Its fast
    • Its very common.
  • The difference between shell and scripts
    • A Shell script is a file containing commands for the shell.
    • A Bash script is simply a file containing commands for the Bash shell.
  • Why Bash is more popular
  • Why Scripting is a useful skill to learn...
Questions
  1. What is a bash script?
    1. A Bash script contains a list of commands specifically for the Bash shell.
  2. A shell is a program that interprets commands and passes them on to the operating system?
    1. True
  3. A benefit of bash is that it has a lot of features
    1. True
  4. Why should you write a script?
    1. The main benefits of writing scripts is to help you automate tasks and save you time
Class 03 [ Bash Script Structure - Part 1 - Core Components ]
  • file <File_name>
    • #!/bin/bash----------------------------------------------> Shebang line
    • #!/usr/bin/python3
    • Exit Statement  ( 0 = Sucessfull ; 1-255 = Unsucessfull )

  • #!/bin/bash
  • echo "This is my first Script"
  • exit 0
after that, we need to check the permission of the particular file.
ls
give permission to the file
chmod +x <File_name>
run the file
./<File_name>

Class 04 [ Bash Script Structure - Part 2 - Professional Components ]

 Comments:
   Single line Comments -----------#
   Double line Comments----------

# Author: Y Reddy Sekhar
# Date Created: 10-11-2022
# Last Modified: 10-11-2022

# Description 
# Prints "This is my first script" to the terminal

# Usage
# Provide file name here...

Class 05 [ Setting up Secure Script Permissions ]
  • The basics of file permissions
  • Setting file permission on your script
ls-l
chmod 744 <File_name>
chmod 777 <File_name>

Class 06 [ Project: Backup Script ]
File downloaded on your personal computer go and see it...

 

Class 07 [ Backup Script - Project Solution ]
                    While doing practice watch again.

Class 08 [ Adding scripts to your PATH ]
  • What is the PATH Variable?
  • How to add directories to your PATH Variable
echo "$PATH"

Class 09 [ Section Summary ]
        Document downloaded


 










    Labels:

    0 Comments:

    Post a Comment

    Subscribe to Post Comments [Atom]

    << Home