Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux下sqlshell直接执行sql语句报错 #180

Closed
ContyChen opened this issue May 19, 2023 · 3 comments
Closed

linux下sqlshell直接执行sql语句报错 #180

ContyChen opened this issue May 19, 2023 · 3 comments

Comments

@ContyChen
Copy link

wsl环境下运行sqlshell 直接执行语句报错:
image

./sqlshell.sh -url jdbc:lealone:tcp://127.0.0.1/lealone -user root -sql "select 1"
错误信息:
Options are case sensitive. Supported options are:

[-help] or [-?] Print the list of options
[-url ""] The database URL (jdbc:lealone:...)
[-user ] The user name
[-password ] The password
[-database ] The database
[-sql ""] Execute the SQL statements and exit

If special characters don't work as expected,
you may need to use -Dfile.encoding=UTF-8 (Mac OS X) or CP850 (Windows).

Connection closed

@codefollower
Copy link
Member

我在最新的 lealone 5.2 中已经加了错误提示,用 5.2 跑,错误提示是: Unsupported option: 1
说明在 wsl 中执行 shell 时,-sql "select 1" 被当成了3个参数,变成 -sql select 1 了,这个确实有点奇怪,
说明用 $@ 来接收参数并不能完整解析 "select 1",如果在 windows 10 里执行 sqlshell.bat 是没问题的,会把 "select 1" 当成一个整体。

@qdongxu
Copy link

qdongxu commented May 19, 2023

linux 上加上引号,"$@" 往下传递,但是不知道在Windows 下是否兼容这个用法。

@codefollower
Copy link
Member

linux 上加上引号,"$@" 往下传递,但是不知道在Windows 下是否兼容这个用法。

我试了,在多个 sh 文件中全加上 "$@" 确实可以,漏加一个都不行。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants