multiple curls with user auth
By Andrew Adams •
I want to automate some config file downloads from my repo without using git (just plain set up configurations) and for that I'd like to download those files with curl. As I need user auth for it im curious how I could handle this within one command?
curl --user Linus -o /home/user/download && -o /home/user/forlaterusageabove command does not work as intended.
What I want to achieve is that I only have to enter my password once for multiple downloads.
1 Answer
You can use -u or --user with "user:password" format:
#!/bin/bash
user=Linus
read -sp "Enter Password: " password
curl -u "$user:$password" -o /path/to/output1
curl -u "$user:$password" -o /path/to/output2 1