Answer the question
In order to leave comments, you need to log in
How to get all directories into an array and walk through them with the analog of foreach?
Actually, connoisseurs :)
How to organize a loop through to use each element?
This is what it is now but it shows everything as 1 elementdeclare -a files=`ls PATH`
Answer the question
In order to leave comments, you need to log in
You can use find :
find /etc/* | while read -r path; do
if ; then
printf "Файл: %s\n" "$path";
elif ; then
printf "Мамка: %s\n" "$path";
fi
done
-maxdepth 0
. -type d
. -type f
.find /etc/* -maxdepth 0 | while read -r path; do
if ; then
printf "Файл: %s\n" "$path";
elif ; then
printf "Папка: %s\n" "$path";
fi
done
find --help
. declare -a files
find /etc/* -maxdepth 0 -type f | while read -r path; do
files+=("$path")
done
>declare -a files=`ls $MY_PATH`
cd "$MY_PATH"
files=( */ )
ls
in a Bash program is justified.) for file in */; do
echo "$file"
done
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question