use cut instead of substr
fix compatable problem in zsh