#!/bin/bash

#-----
# list-for-demo
#
# practing with list-style for loops
#
# by: Sharon Tuttle
# last modified: 2022-09-14
#-----

# loop through all the files in the current directory

echo first for loop results:
echo ""

for filename in `ls`
do
    echo LOOKY: $filename
done

# loop through the command line arguments
# NOTE: if not double-quoted, $@ here
#     won't maintain blanks in arguments...!

echo ""
echo second for loop results:
echo ""

for arg in $@
do
    echo "ARGUMENT when NO double quotes around \$@: $arg"
done

echo ""
echo third for loop results:
echo ""

for arg in "$@"
do
    echo "ARGUMENT when HAVE double quotes around \$@: $arg"
done