in this code i just save paths into array#1. This array works fine:
echo "Searching for *omd*-paths..."
cd /
# creating array#1
all_omd_paths=`find -type d -name omd`
Ok, but now i want to put specific paths into another array (array#2):
for path in $all_omd_paths
do
if [[ $path == *"s"* ]]; then
# fill array#2
omd_sites_paths+=($path)
fi
done
for path in $omd_sites_paths
do
# wrong output
echo $path
done
With the second for-loop i just get ONE path on output... But i know there are more saved in array#1. What s wrong with array#2? How do i fill it correctly?
如果$ omd_sites_paths是一个数组:
for path in ${omd_sites_paths[@]}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.