#!/bin/bash

# ideone boilerplate - we can't write files in the home directory;
# so create a temporary directory for our files instead
t=$(mktemp -d -t ideone.XXXXXXXXXXXX) || exit
trap 'rm -rf "$t"' ERR EXIT
cd "$t"

touch "foo
bar" "*" "\"sick'ly\""

echo "*** naive attempt (broken quoting) ***"
count=0
for file in ./*; do
    ((++count))
    echo $count: $file
done
echo "$count files total"

echo "*** ls (broken) ***"
ls | nl

echo "*** find (mildly broken) ***"
find . -type f | nl

echo "*** bash array ***"
files=(*)
printf ">>%s<<\n" "${files[@]}"
echo "${#files[@]} files total"