Created
June 15, 2011 12:24
-
-
Save palaniraja/1026973 to your computer and use it in GitHub Desktop.
Shell script to populate sample images for array of names
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
productIds=("5108401" "5108004" "5084002" "084003" "513802" "510724" "1083800" "31083" "313725" "5084224" "82759" "11735" "1104_2" "11268" "133" "11084_2" "114189" "1721" "143" "SA058" "0848_1" "540854" "140876" "34_4" "34068" "584397" "6296" "640008" "09T-IC" "653" "54086" "1903" "3315" "54587" "54527" "B23" "SOF43-TP" ) | |
productImgs=( "productImage.png" "productImage-1.png" "productImage-2.png" "productImage-3.png" "productImage-4.png") | |
prodLen=${#productIds[@]} #productid array length | |
imgLen=${#productImgs[@]} #img array length | |
# use for loop to read all productids | |
for (( i=0; i<${prodLen}; i++ )); | |
do | |
cp "${productImgs[$((RANDOM%imgLen))]}" "ProductImages/${productIds[$i]}.png" | |
done | |
echo "Completed generating $prodLen images from $imgLen sample images." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment