Skip to main content

Command Palette

Search for a command to run...

Shell Scripting for devops Engineer

Published
2 min readView as Markdown
Shell Scripting for devops Engineer
S

I am a student at AITR indore. I am learning devops as well with my studies.

Hey, guys Today we are going to learn something about shell Scripting.

What is Shell scripting?

  • Shell scripting is a kind of collection set of commands or stuff that can do some work or operations.

  • There are some types of Shell Scripting are as follows.

    • first is bash

    • second is c shell

    • third z shell

  • Every Shell Script has its production kind of things

    • example:- #!/bin/bash, #!/bin/sh etc.
  • You can save your shell script with .sh.

  • After that, you have to change the permissions to execute the shell script because it is read and write by default.

  • You can execute a shell script ./script_name.

Some amazing stuff about shell scripting are as follows.

  • You can make any reference variable without giving any data type.

  • You can use $ sign for printing any stuff that was contained in the reference variable.

  • You can take input as well by just writing a { read variable_name}.

  • You can take the argument as well by just writing $1 so it will take only one argument.

    • example:- echo " welcome $1"

      While you execute ./script_name shubham

      output:- welcome shubham

  • For taking all arguments or whatever you would write after your script name {./script_name 'here you can write your argument'} you can use $@

    • echo " welcome $@"

      While you execute ./script_name shubham classes

      output:-welcome shubham classes.

  • We also can use conditional statements by the use of if and else

  • We also can use loops.

  • we also use Shell Scripting for backups because teh #DevDps engineer has to do it many times.

  • You can use Shell Scripting for executing many commands at a time.

So, yah that It for the day. I will come again with another exciting topic in DevOps.

More from this blog

Sumit deshmukh's blog

10 posts