cygwin: syntax error issue.

syntax error:

用notepad的在windows下编写的bash脚本出现syntax error.

example:

#!/bin/bash

if [ -z $1 ];then

echo $1

fi

解决:

1. sh -x test.sh

prompt: +echo $'\r'

2. sed -i 's/\r//' test.sh

3. and then run it.

你可能感兴趣的:(error,cygwin,职场,休闲,syntax)