1. Makefile與Shell取環境變量的不同方法
Makefile: cc=$(CROSS_COMPILE)
Shell: cc=$CROSS_COMPILE
2.從命令中得到值
removable=$(cat /sys/block/$1/removable)
3. while
export TSLIB_TSDEVICE=/dev/ts
counter=1
while [ 1 ] --> 無限循環
while [ $counter -lt 10 ]
do
aplay music.wav &
ts_test &
counter_inner=1
while [ $counter_inner -lt 60 ]
do
sleep 4
counter_inner=$(( $counter_inner + 1 ))
done
pkill ts_test
counter=$(( $counter + 1 ))
echo "the counter is $counter"
done
4. For
for file in $( find . -type f -name "*.bz2" | sort )
do
tar xvfj $file -C /scratch/paul/lite/linux/src/
done
5. 如何過濾bash的錯誤輸出?
arm-none-linux-gnueabi-gcc -v 2>/dev/null
stdin 0<
stdout 1>
stderr 2>