撰寫第一支 script - 輸入大量圖片檔名
用途:使用Android Animation-List 需要大量輸入圖片的檔名,我們都需要一組可以重覆或判斷資訊的指令, 身為工程師的我就應該寫個程式解決這件事。
之後command line輸入即可
#!/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/winning_gif_duration"/>
<item
android:drawable="@drawable/winning_screen103"
android:duration="@integer/winning_gif_duration"/>
<item
android:drawable="@drawable/winning_screen104"
android:duration="@integer/winning_gif_duration"/>
此為筆記用途^^
留言
張貼留言