- 背景 执行*.sh命令时候出现如下问题
: invalid option
Usage: /bin/bash [GNU long option] [option] ...
/bin/bash [GNU long option] [option] script-file ...
GNU long options:
--debug
--debugger
--dump-po-strings
--dump-strings
--help
--init-file
--login
--noediting
--noprofile
--norc
--posix
--protected
--rcfile
--rpm-requires
--restricted
--verbose
--version
Shell options:
-irsD or -c command or -O shopt_option (invocation only)
-abefhkmnptuvxBCHP or -o option
-
原因,是因为脚本直接从windows系统复制过来导致的
-
解决方案
安装dos2unix
# yum install dos2unix
转换脚本
dos2unix *.sh
- 再次执行*.sh脚本即可