Bash Scripting - 1

12 Oct 2022

Post contains only Bash script sample.

hello_bash.sh

#!/bin/bash
echo "Hello, Bourne Again Shell!"

variables.sh

#!/bin/bash
FIRST_NAME="Sajid"
LAST_NAME="Hasan"
LOCATION=London
FILE_LOCATION=`pwd`


echo My name is $FIRST_NAME $LAST_NAME
echo "Friends call me $FIRST_NAME!"
echo "I am based in ${LOCATION}"
echo $FILE_LOCATION
echo Name of this file is $0
echo "This file is located in directory $FILE_LOCATION"
echo "Other files in this directory: $(ls)"

variable_arguments.sh

#!/bin/bash
echo "Name of the file $0"
echo "Given name: $1"
echo "Surname: $2"
echo "Number of arguments: $#"
echo "List of argument(s): $@"