Use the -u
flag to include a username, and curl will prompt for a password:
(使用-u
标志包含用户名,curl会提示输入密码:)
curl -u username http://example.com
You can also include the password in the command, but then your password will be visible in bash history:
(您还可以在命令中包含密码,但是您的密码将在bash历史记录中显示:)
curl -u username:password http://example.com
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…