-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.sh
executable file
·43 lines (42 loc) · 1.29 KB
/
template.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
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
export AWS_DEFAULT_REGION=us-east-1
echo "AWS_DEFAULT_REGION= " $AWS_DEFAULT_REGION
az=($(aws ec2 describe-availability-zones --output text | cut -f 4))
index=0
element_count=${#az[*]}
while [ $index -lt $element_count ]
do
echo ${az[$index]}
# arithmetic evaluation ((x))
((index++))
done;
# Put in ˜/bin - Needs chmod 755 <filename>
# Execute: ./hello_world
echo 'Hello World!' #another comment
#
# a=z # Assign the string "z" to variable a
# b="a string" # Embedded spaces must be within quotes.
# c="a string and $b" # Other expansions such as variables can be expanded into the assignment.
# d=$(ls -l foo.txt) # Results of a command.
# e=$((5 * 7)) # Arithmetic expansion.
# f="\t\ta string\n" # Escape sequences such as tabs and newlines.
# ====================================================================
# Put the AZs into an array
az=($(aws ec2 describe-availability-zones --output text | cut -f 4))
#
index=0
# How many are there?
az_count=${#az[*]}
echo "AZ count " $az_count
# List AZs
while [ $index -lt $az_count ]
do
echo ${az[$index]}
# arithmetic evaluation syntax ((x))
((index++))
done;
#
# ====================================================================
# date
token=$(date +"%Y%m%d%H%M%S%N")
echo $token