Skip to main content

Command Palette

Search for a command to run...

Basic Shell scripting commands

Published
•1 min read•View as Markdown
Basic Shell scripting commands
  1. Creating a .sh file

  2. Giving execute permission using chmod 777 <filename>

    777 represent read write and execute.

  3. Adding #!/bin/bash in .sh file as the beginning of a script or executable file , we can also use #!/bin/sh which selects the default system shell.

  4. running the script using ./<filename>

  5. echo: echo is used to display the string on the console.

  6. variable: define a variable using = operator without any spaces.

    eg: name="Bharat"

  7. sleep: used to hold the execution for the defined number of seconds.

  8. argument: arguments passed from the console are used using $ followed by its count.

  9. if else :

    general syntax :

    if [ "parameter1" condition "parameter2" ]

    then

    statement

    else

    statement

    fi

More from this blog

Bharat's blog

15 posts