Skip to content

Commit be8ec6e

Browse files
committed
updated
1 parent cd13702 commit be8ec6e

File tree

12 files changed

+36
-41
lines changed

12 files changed

+36
-41
lines changed

01-saying-hello/index.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/bash
1+
#!/usr/bin/env bash
22

33
read -p "What is your name? " ANSWER;
44

02-counting-characters/challenge.bash

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#!/usr/bin/bash
1+
#!/usr/bin/env bash
22

33
read -p "What is the input string? " STR;
44

5-
if [ -z "$STR" ]
5+
if [ -z "$STR" ];
66
then
77
echo "Hey! Try again and enter something.";
88
else

02-counting-characters/index.bash

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#!/usr/bin/bash
1+
#!/usr/bin/env bash
22

33
read -p "What is the input string? " STR;
44

5-
STR_LENGTH=${#STR}
5+
STR_LENGTH=${#STR};
66

77
echo "$STR has $STR_LENGTH characters.";

03-printing-qoutes/index.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/bash
1+
#!/usr/bin/env bash
22

33
read -p "What is the qoute? " QOUTE;
44

04-mad-lib/index.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/bash
1+
#!/usr/bin/env bash
22

33
read -p "Enter your nickname: " NAME;
44

05-simple-math/index.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/bash
1+
#!/usr/bin/env bash
22

33
read -p "What is the first number? " X;
44

06-retirement-calculator/index.bash

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
#!/usr/bin/bash
1+
#!/usr/bin/env bash
22

33
read -p "What is your current age? " CURRENT_AGE;
44

55
read -p "At what age would you like to retire? " OLD_AGE;
66

7-
DIFF=$(( OLD_AGE - CURRENT_AGE ))
8-
CURRENT_YEAR=$(date +%Y)
9-
RETIREMENT_YEAR=$(( CURRENT_YEAR + DIFF ))
7+
DIFF=$(( OLD_AGE - CURRENT_AGE ));
8+
9+
CURRENT_YEAR=$(date +%Y);
10+
11+
RETIREMENT_YEAR=$(( CURRENT_YEAR + DIFF ));
1012

1113
echo "
1214
You have $DIFF years left until you retire.

07-area-of-a-rectangular-room/index.bash

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
#!/usr/bin/bash
1+
#!/usr/bin/env bash
22

33
read -p "What is the length of the room in feet? " LENGTH;
44

55
read -p "What is the width of the room in feet? " WIDTH;
66

7-
AREA_IN_FEET=$(( LENGTH * WIDTH ))
7+
AREA_IN_FEET=$(( LENGTH * WIDTH ));
88

9-
LENGTH_IN_M=$(( LENGTH * 3 / 10 ))
9+
LENGTH_IN_M=$(( LENGTH * 3 / 10 ));
1010

11-
WIDTH_IN_M=$(( WIDTH * 3 / 10 ))
11+
WIDTH_IN_M=$(( WIDTH * 3 / 10 ));
1212

13-
AREA_IN_SQUAREMETERS=$(( LENGTH_IN_M * WIDTH_IN_M ))
13+
AREA_IN_SQUAREMETERS=$(( LENGTH_IN_M * WIDTH_IN_M ));
1414

1515
echo "
1616

08-pizza-party/index.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/bash
1+
#!/usr/bin/env bash
22

33
echo -e "\n [$] Pizza Party \n";
44

09-paint-calculator/index.bash

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
#!/usr/bin/bash
1+
#!/usr/bin/env bash
22

33
echo -e "\n [$] Paint Calculator \n";
44

55
read -p "What is the length of the room? " LENGTH;
66

77
read -p "What is the width of the room? " WIDTH;
88

9-
AREA=$(( LENGTH * WIDTH ))
10-
PAINT_IN_GALLONS=$(( AREA / 350 ))
11-
EXCESS_AREA=$(( AREA % 350 ))
9+
AREA=$(( LENGTH * WIDTH ));
10+
PAINT_IN_GALLONS=$(( AREA / 350 ));
11+
EXCESS_AREA=$(( AREA % 350 ));
1212

13-
if [ "$EXCESS_AREA" -ge 0 ]
13+
if [ "$EXCESS_AREA" -ge 0 ];
1414
then
15-
(( ++PAINT_IN_GALLONS ))
15+
(( ++PAINT_IN_GALLONS ));
1616
fi
1717

1818
echo "

10-self-checkout/index.bash

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/bash
1+
#!/usr/bin/env bash
22

33
read -p "Enter the price of Item 1: " ITEM_1_PRICE;
44
read -p "Enter the quantity of Item 1: " ITEM_1_QTY;
@@ -15,13 +15,13 @@ read -p "Enter the quantity of Item 3: " ITEM_3_QTY;
1515

1616
echo "";
1717

18-
ITEM_1=$(( ITEM_1_PRICE * ITEM_1_QTY ))
19-
ITEM_2=$(( ITEM_2_PRICE * ITEM_2_QTY ))
20-
ITEM_3=$(( ITEM_3_PRICE * ITEM_3_QTY ))
18+
ITEM_1=$(( ITEM_1_PRICE * ITEM_1_QTY ));
19+
ITEM_2=$(( ITEM_2_PRICE * ITEM_2_QTY ));
20+
ITEM_3=$(( ITEM_3_PRICE * ITEM_3_QTY ));
2121

22-
SUBTOTAL=$( echo "val = ($ITEM_1 + $ITEM_2 + $ITEM_3); scale=2; val / 1" | bc -l )
23-
TAX=$( echo "val = ($SUBTOTAL / 1000) * 55; scale=2; val / 1" | bc -l )
24-
TOTAL=$( echo "val = ($SUBTOTAL + $TAX); scale=2; val / 1" | bc -l )
22+
SUBTOTAL=$( echo "val = ($ITEM_1 + $ITEM_2 + $ITEM_3); scale=2; val / 1" | bc -l );
23+
TAX=$( echo "val = ($SUBTOTAL / 1000) * 55; scale=2; val / 1" | bc -l );
24+
TOTAL=$( echo "val = ($SUBTOTAL + $TAX); scale=2; val / 1" | bc -l );
2525

2626
echo -e "Subtotal: $ $SUBTOTAL";
2727
echo -e "Tax: $ $TAX";

init.bash

+3-10
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,12 @@ touch "$D_SHELL";
3333
# make it executable
3434
chmod +x "$D_SHELL";
3535
# add initial line
36-
echo "#!$BASH" > "$D_SHELL";
37-
38-
# echo -e "\n\t| - creating $D_CFILE";
39-
40-
# # creating C file
41-
# touch "$D_CFILE";
42-
# # add template
43-
# echo -e "#include<stdio.h>\n\n\nint main () {\n\t// ...\n\n\treturn 0;\n\n}" > "$D_CFILE";
44-
45-
echo -e "\n\t| - creating $D_README";
36+
echo "#!/usr/bin/env bash" > "$D_SHELL";
4637

4738
# creating readme.md file
39+
echo -e "\n\t| - creating $D_README";
4840
touch "$D_README";
41+
4942
# add template
5043
echo -e "<p align=\"center\">
5144
<img width=\"300\" src=\"../bash-logo-dark.jpg\" alt=\"Bash Logo\">

0 commit comments

Comments
 (0)