星期四, 6月 14, 2012

BASH filename handling

Get filename
$(basename $pathname)

file extension
${filename##*.}

filename without extension
${filename%.*}

Search "bash string substitution" in Google for more detail.

星期三, 1月 04, 2012

Cygwin rebase

If you got errors like fork() or stack exceptions when starting cygwin, try rebase.

Here the steps to run rebase:
0. Close all cygwin app/terminal
1. start a Windows cmd terminal console (not cygwin terminal, this is very important)
2. #cd c:\cygwin\bin (where your cygwin binaries are installed)
3. #ash
4. #./rebaseall

Done!