M HYPE SPLASH
// updates

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/forlaterusage

above 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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy