Last active
August 29, 2015 14:12
-
-
Save xkr47/2b0a1338067bc200e0ae to your computer and use it in GitHub Desktop.
Feed username/password to curl without temporary files and without showing in process list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: curlum <username> <password> <curl args...> | |
curlum () { | |
user="$1" | |
pass="$2" | |
shift 2 | |
curl --config /dev/fd/3 "$@" 3<<EOF | |
--user $user:$pass | |
EOF | |
} | |
# example | |
USER=foo | |
PASS=bar | |
curlum $USER $PASS http://localhost:1234/index.html |
Apparently the --netrc-file option was added in curl 7.21.5. Script updated to use --config instead.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works also together with --data @- like this: