diff --git a/Linux Shell/A Personalized Echo.sh b/Linux Shell/A Personalized Echo.sh index be321acc..ae8c79d5 100644 --- a/Linux Shell/A Personalized Echo.sh +++ b/Linux Shell/A Personalized Echo.sh @@ -9,6 +9,8 @@ #One line: "Welcome (name)" (quotation marks excluded). #The evaluation will be case-sensitive. +#!/bin/bash + read name echo "Welcome $name" diff --git a/Linux Shell/Arithmetic Operations.sh b/Linux Shell/Arithmetic Operations.sh index 0b8c163e..0c45c900 100644 --- a/Linux Shell/Arithmetic Operations.sh +++ b/Linux Shell/Arithmetic Operations.sh @@ -8,9 +8,9 @@ # 17.929 +#!/bin/bash + read p1 -read p2 -read p3 -printf "%.3f\n" `echo $p1 | bc -l` +printf "%.3f\n" $(echo "$p1" | bc -l) diff --git a/Linux Shell/Comparing Numbers.sh b/Linux Shell/Comparing Numbers.sh index fd565128..b8e1e17f 100644 --- a/Linux Shell/Comparing Numbers.sh +++ b/Linux Shell/Comparing Numbers.sh @@ -16,6 +16,8 @@ #- X is greater than Y #- X is equal to Y +#!/bin/bash + read firstNumber read secondNumber if (($firstNumber > $secondNumber)); then diff --git a/Linux Shell/Getting started with conditionals.sh b/Linux Shell/Getting started with conditionals.sh index 501cd690..fb191c96 100644 --- a/Linux Shell/Getting started with conditionals.sh +++ b/Linux Shell/Getting started with conditionals.sh @@ -11,5 +11,7 @@ # echo YES or NO to STDOUT. +#!/bin/bash + read c [[ "$c" == [yY] ]] && echo "YES" || echo "NO" diff --git a/Linux Shell/Let's Echo.sh b/Linux Shell/Let's Echo.sh index 0ee50f1b..df77fa4b 100644 --- a/Linux Shell/Let's Echo.sh +++ b/Linux Shell/Let's Echo.sh @@ -8,4 +8,6 @@ #HELLO +#!/bin/bash + echo "HELLO" diff --git a/Linux Shell/Looping and Skipping.sh b/Linux Shell/Looping and Skipping.sh index 716591c1..e5982614 100644 --- a/Linux Shell/Looping and Skipping.sh +++ b/Linux Shell/Looping and Skipping.sh @@ -11,9 +11,10 @@ #. #99 +#!/bin/bash for i in {1..99..2} do - echo $i + echo "$i" done diff --git a/Linux Shell/Looping with Numbers.sh b/Linux Shell/Looping with Numbers.sh index 221b0fa8..ce16a202 100644 --- a/Linux Shell/Looping with Numbers.sh +++ b/Linux Shell/Looping with Numbers.sh @@ -15,6 +15,8 @@ #. #50 +#!/bin/bash + X=1 while [ $X -le 50 ] do diff --git a/Linux Shell/More on Conditionals.sh b/Linux Shell/More on Conditionals.sh index 962ef47b..9ab72352 100644 --- a/Linux Shell/More on Conditionals.sh +++ b/Linux Shell/More on Conditionals.sh @@ -11,6 +11,7 @@ # One word: either "SCALENE" or "EQUILATERAL" or "ISOSCELES" (quotation marks excluded). +#!/bin/bash read c1 read c2 diff --git a/Linux Shell/README.md b/Linux Shell/README.md index a8a946a1..67529c60 100644 --- a/Linux Shell/README.md +++ b/Linux Shell/README.md @@ -1,6 +1,6 @@ # Linux Shell -- [Let's Echo](https://github.com/Aby-Sebastian/Hackerrank-Codes/blob/add-c/Linux%20Shell/Let's%20Echo.sh) -- [Looping and Skipping](https://github.com/Aby-Sebastian/Hackerrank-Codes/blob/add-c/Linux%20Shell/Looping%20and%20Skipping.sh) -- [Middle of a Text File](https://github.com/Aby-Sebastian/Hackerrank-Codes/blob/add-c/Linux%20Shell/Middle%20of%20a%20Text%20File.sh) +- [Let's Echo](https://github.com/Aby-Sebastian/Hackerrank-Codes/blob/add-c/Linux%20Shell/Let's%20Echo.sh) +- [Looping and Skipping](https://github.com/Aby-Sebastian/Hackerrank-Codes/blob/add-c/Linux%20Shell/Looping%20and%20Skipping.sh) +- [Middle of a Text File](https://github.com/Aby-Sebastian/Hackerrank-Codes/blob/add-c/Linux%20Shell/Middle%20of%20a%20Text%20File.sh) diff --git a/Linux Shell/The World of Numbers.sh b/Linux Shell/The World of Numbers.sh index 256614d7..722f90c8 100644 --- a/Linux Shell/The World of Numbers.sh +++ b/Linux Shell/The World of Numbers.sh @@ -8,6 +8,7 @@ #Four lines containing the sum (X+Y), difference (X-Y), product (X*Y), and quotient (X/Y), respectively. #(While computing the quotient, print only the integer part.) +#!/bin/bash read x read y