-
Notifications
You must be signed in to change notification settings - Fork 0
/
day002_variables.sh
30 lines (26 loc) · 1.19 KB
/
day002_variables.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
###########################################################
# #
# Script Name: Day 002 - Variables #
# #
# Author: Marcos Vinícius Brás de Oliveira #
# #
# Created at: 30/04/2018 #
# #
##[ Description ]##########################################
# #
# Show how to create and delete variables. #
# #
###########################################################
## To create a variable, it can't have spaces around "="
SENTENCE="Shell Script is so awesome!"
echo $SENTENCE # $ Shell Script is so awesome!
# Output: Shell Script is so awesome!
## Getting the output of another command to a variable
CURRENT_DATE=$(date)
echo "The current date is: $CURRENT_DATE"
# Output: The current date is: dom abr 29 13:43:59 -03 2018
## Unset deletes a variable
unset CURRENT_DATE
echo $CURRENT_DATE
# Output: