Community Page
- www.tech-recipes.com/ Jump to website »
-
Subscribe -
Community
-
Top Commenters
-
Popular Threads
-
Recent Comments
- Google is the best search engine...what else I can say? But I dont use google chrome, I prefer other browser
- Thank you so much i haven't had to do that on vista and nearly two years and have used a seperate quick launce bar for many many years and it was driving me insane
- Lovely! I completely forgot about dos2unix and sincerely I like to use vim better if I can :)
- hey shay, just added you. add me if you want 4285 2670 2528 4658
- Thats cool Stuff as i m Nebie to unix
Tech-Recipes
Cookbook of Tech Tutorialsbash shell script declaring/creating arrays | Bourne shell scripting | Tech-Recipes
Started by qdideas · 9 months ago
4 years ago
for foo in $(find -type f -iname "*.png" -printf "%fn"); do
file[${#file[*]}]=$foo
done
will create an array of all png files
7 months ago
6 months ago
set -A array_example 1 2 3 4 5
i=0
echo ${array_example[$i]}
5 months ago
#existing array
existing=(item1, item2, item3);
#items to merge (including an item requiring correct quoting)
merge=(item4 item5 "${item6}*");
count=${#existing[@]};
num_new_items=${#merge[@]};
# this loop appends items to the end of the array
for (( i=0;i<$num_new_items;i++)); do
echo ${i};
existing[$count]=${merge[${i}]};
let count+=1;
done
count=${#existing[@]}
for (( i=0;i<$count;i++)); do
echo ${existing[${i}]};
done
5 months ago
You can do it this way:
<pre>
cat $file | while read line; do
echo "$line";
done
</pre>
2 months ago
2 months ago