Skip to content

Instantly share code, notes, and snippets.

@RayZ0rr
Created January 13, 2022 19:12
Show Gist options
  • Save RayZ0rr/d660d99d50ddd534d0965af248281c76 to your computer and use it in GitHub Desktop.
Save RayZ0rr/d660d99d50ddd534d0965af248281c76 to your computer and use it in GitHub Desktop.
A test bash array
#!/usr/bin/env bash
# find "${1}" -maxdepth 1 -not -path "${1}" -type d -printf "%f\n"
# find "${1}" -maxdepth 1 -not -path "${1}" -type d -print0
readarray -d '' myArray1 < <(find "${1}" -maxdepth 1 -not -path "${1}" -type d -printf "%f\n")
readarray -d '' myArray2 < <(find "${1}" -maxdepth 1 -not -path "${1}" -type d -print0)
echo "myArray1\n"
for i in "${myArray1[@]}" ; do
echo "$i "
done
echo "myArray2\n"
for i in "${myArray2[@]}" ; do
echo "$i "
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment