#!/bin/bash

# bracket-all
#
# demo one of several ways of reading all the
#     lines in a file
#     (and here, output them in square brackets)
# ...seems to strip leading blanks, trailing blanks...?
#
# by: Sharon Tuttle
# last modified: 2022-10-17

# determine the desired file

if [ $# -lt 1 ]
then
    echo -n "Enter desired filename: "
    read filename
else
    filename=$1
fi

# read all its lines and output in square brackets

while read next_line
do
    echo "[$next_line]"
done < "$filename"