Wednesday, April 6, 2022

Linux Shell Script Basic Examples

Comments

Comments are those lines that are only used for reference purposes but can not be executed.

Write a script to enter a Name of a Person and print that name.

#! /bin/bash

#Author Raman
# Copyright (c)  Raman
# Below is the script
echo "Enter Name"
read Person
# This will print the  name of the person
echo "Hello, $Person"

Execution of a shell Script

Let's say the file name is test.sh

Provide execute permission to test.sh

  • chmod u+x test.sh
  • ./test.sh
  • or
  • sh test.sh



0 comments:

Post a Comment