1

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 https://my.repo.com/repo/file.txt -o /home/user/download && https://my.repo.com/repo/file2.txt -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 1

2

You can use -u or --user with "user:password" format:

#!/bin/bash
user=Linus
read -sp "Enter Password: " password
curl -u "$user:$password" http://example.com/file1.txt -o /path/to/output1
curl -u "$user:$password" http://example.com/file2.txt -o /path/to/output2
1
  • y that approach seems legit, ill add an unset password at the end and all should be fine. ty
    – konstapel
    Jul 16, 2020 at 14:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .