撰寫第一支 script - 輸入大量圖片檔名
用途:使用Android Animation-List 需要大量輸入圖片的檔名,我們都需要一組可以重覆或判斷資訊的指令, 身為工程師的我就應該寫個程式解決這件事。 #!/bin/bash for i in {1..104}; do ZERO_NUM=$(printf "%03d" $i); echo \<item >> tmp.txt echo android:drawable=\"@drawable/winning_screen$ZERO_NUM\" >> tmp.txt echo android:duration=\"@integer/winning_gif_duration\"\/\> >> tmp.txt done 副檔名sh 之後command line輸入即可 sh firstScript.sh tmp.txt <item android:drawable="@drawable/winning_screen001" android:duration="@integer/winning_gif_duration"/> <item android:drawable="@drawable/winning_screen002" android:duration="@integer/winning_gif_duration"/> <item android:drawable="@drawable/winning_screen003" android:duration="@integer/winning_gif_duration"/> . . . <item android:drawable="@drawable/winning_screen102" android:duration="@integer/winni