Live Chat!

stupid way to make mplayer repeatly play

0 votos Vota!!

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 very fast!
heh! [...]

Posted in Bash, for, mplayer, sleep | Hits: 37171 | 14 Comments »

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

4 votos Vota!!

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: 21003 | 9 Comments »

Rename multiple files

7 votos Vota!!

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
${variable%pattern} vs ${variable#pattern}
The funny-looking symbol, ${f%.txt} [...]

Posted in Common, Regular Expression, for, mv | Hits: 100364 | 16 Comments »