Files
hpr_website/www/eps/hpr2739/hpr2739_bash19_ex1.sh

33 lines
585 B
Bash
Executable File

#!/bin/bash
#-------------------------------------------------------------------------------
# Example 1 for Bash Tips show 19: how an integer array works
#-------------------------------------------------------------------------------
#
# Declare an integer array and a normal one
#
declare -a -i ints
declare -a norm
#
# Load both with arithmetic expressions
#
ints=('38 % 7' '38 / 7')
norm=('38 % 7' '38 / 7')
#
# Try storing a string in each of the arrays
#
ints+=('jellyfish')
norm+=('jellyfish')
#
# Show the results
#
echo "ints: ${ints[*]}"
echo "norm: ${norm[*]}"
exit