Skip to content

Latest commit

 

History

History
122 lines (83 loc) · 2.3 KB

README.MD

File metadata and controls

122 lines (83 loc) · 2.3 KB

Shell Script

steps:

  • Create repo in Github
  • Clone repo in local laptop
  • Start developing
  • Add the files to temp area

'''''''''''''''''''''''''''''''''''' I am learning shell and git i am doing another change i can changes any no of times

'''''''''''''''''''''''''''''''''' git add


- Commit the changes

git commit -m "why-you-commited"


- Push the changes to GitHub/Central repo

git push -u origin main


**naming convention: use small case with Hyphons(-). No spaces**

git add . ; git commit -m "some-message"; git push -u origin main


shell scripting. #/bin/bash called shibang will let know the linux how to execut the script through shiband. echo to print echo " hello world, iam learning devops "

variables dry ---dont repeat yourself derive the forula , finally you submit create a variable and assign value to it.. whenever you are using instead of value , replace with varible name

i am going to connect to DB, so i need password. prompt the user to enter read command - it takes the input from the terminal

int i = 0 float a =2.3 boolean true/false string name=saikumar


array for multiple values.


condition in shell script

simple algorithm to install git you should be root user

if [] then These command will run is expression is true

else run if expression is false fi

install sql check root user or not if not root user exit the porg and inform user to run with sudo access if root user install mysql

100 statements: you got error at statement 10, shell script by default will not stop if it faces error it is out responsdibility to check for errors.

exit status: $? it will store the previous command status $? is 0 then previous command status is success.

less lines of code more work.

we have a concept called functions: you will keep some code inside function which is more often repeated and call when ever you enquire. functions will do behalf of us and it will update what happen. FUNCTION_NAME(){ here you write your statemnet and call whenever they required. }

log files are important to know what happend.

(redirection): it will only success output. ls -l > ls.log ls -l > ls.log 1 success 2 failurele

special variables.

colours in shell scripting.

loops if you ask 10 pakages to insatll i want to loop it , then install one by one