BASH-Elements

Bash Elements

Below $1 and $2 are arguments passed while running the script.

where the first element passed is $1 which is 10 and the second element $2 which is 20 and $3...


 Server1>cat test.sh

#/bin/bash

echo $1

echo $2

echo "$1" + "$2"

echo "Sum of $1 and $2 is $(( $1+$2 ))"

echo "Number of arguments passed $#"

echo "Print @ Notation $@"

echo "Echo of 0 is $0" 

echo "Execute a command: `pwd`"


Server1>chmod +x test.sh


Server1>./test.sh  10 20

10

20

Concatinate to elemts: 10  20

Sum of 10 and 20 is 30

Number of arguments passed 2

Print @ Notation 10 20

Print * Notation 10 20

Echo of 0 is ./test.sh

Execute a command: /usr/username


Comments

Popular posts from this blog

AWS: Auto Scaling

Jenkins Pipeline

EC2-Instances-awscli