Created
June 26, 2017 00:26
-
-
Save ScalaWilliam/f882c6dcaebee19a7b6f6bdbbb74d676 to your computer and use it in GitHub Desktop.
Expanding params for curl... cool.
This file contains hidden or 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
``` | |
[03:18] <ScaWilliam> I have a file that contains multiple lines of curl arguments, eg one line -X POST, one line -H 'Content-Type: application/json' one line -d '{"some": "payload"}' --- I tried doing curl "$(cat file.txt)" http://host/ but it won't work - it doesn't evaluate the arguments properly. How do I do what I want? | |
[03:20] <greycat> ScaWilliam: mapfile -t curlargs < myfile; curl "${curlargs[@]}" "$url" | |
[03:30] <ScaWilliam> @greycat your command worked with one line -X, another POST, another -H another Content-Type: ... | |
[03:31] <greycat> But...? | |
[03:31] * greycat waits for "I actually have multiple options per line and they're shell-quoted" | |
[03:31] <ScaWilliam> hah no, figured out that one myself. | |
[03:31] <ScaWilliam> thanks, I'll share your website on twitter, this was very helpful :-) | |
lsof -n | awk '{print $2}'|sort|uniq -c|awk '{print $1,$2}'|sort -k 1n|tail | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment