#!/bin/bash
# Check if a directory was provided
if [ "$#" -ne 1 ]; then
    echo "Usage: $0 <directory>"
    exit 1
fi

# Remove any trailing slash for consistency
directory="${1%/}"

# Check if the provided argument is a valid directory
if [ ! -d "$directory" ]; then
    echo "Error: '$directory' is not a valid directory."
    exit 1
fi

output=""
for file in "$directory"/*; do
    if [ -f "$file" ]; then
        output+="$file "
    fi
done

echo "$output"

