Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- file="emails.txt"
- api_url="..."
- authorization="<user>:<api_key>"
- mail_count=$(cat $file | wc -l)
- #convert to integer by adding 0:p
- mail_count=$(($mail_count+0))
- echo $mail_count
- json_arr="["
- i=1
- quote="\""
- while read line
- do
- json_arr+=$quote
- json_arr+=$line
- json_arr+=$quote
- if [ $i -ne $mail_count ]
- then
- json_arr+=","
- fi
- i=$((i + 1))
- done <$file
- json_arr+="]"
- json_data="{\"mails\":$json_arr}"
- curl -X POST -H 'Content-Type: application/json' -d $json_data $api_url --user $authorization
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement