BTTB: looping for shell script under embedded linux

November 17th, 2010 mysurface

You may already realized Linux happened to appear at many places, such as web server, storage server, desktop, kiosk machine, mobile devices. Yes, more and more devices running embedded Linux. Yeah, Android is a modified version of Linux kernel too! Scarcity is still an issue, embedded Linux can be very different to Linux that hosted [...]

Posted in cut, for, if, seq, Text Manipulation | Hits: 172244 | 10 Comments »

stupid way to make mplayer repeatly play

November 3rd, 2007 mysurface

I am so desperately wanna make mplayer repeat a song, somehow I obtain a song in flv format. I fail to figure out how to make mplayer repeat, so here make a stupid workaround with bash for. for (( ; ; )); do mplayer nicesong.flv; sleep 0.1; done Kill it by hitting ctrl+c two times [...]

Posted in Bash, for, mplayer, sleep | Hits: 67548 | 16 Comments »

download multiple files from a site using for loop like c in bash

February 7th, 2007 mysurface

Batch download using wget seems to be not working anymore, a lots of web site used to protect the particular directory from being browse. But if you know the filename of the files, you still can do a batch download by writing a custom bash script. Recently I discover a site which allows you to [...]

Posted in Bash, for | Hits: 44926 | 11 Comments »

Rename multiple files

November 5th, 2006 toydi

Often over time, we will want to reorganize a group of files by renaming them. To rename *.txt to *.bak (e.g. to rename ham.txt to ham.bak) for f in *.txt; do mv “$f” “${f%.txt}.bak”; done To remove ‘new-’ from new-* (e.g. to rename new-ham.txt to ham.txt) for f in new-*; do mv “$f” “${f#new-}”; done [...]

Posted in Common, for, mv, Regular Expression | Hits: 183985 | 27 Comments »