#!/bin/bash
get_title() {
local domain=$1
local title=$(curl -sL "https://$domain" | grep -oP '(?<=
).*(?=)')
echo "$domain,$title" >> parallel_domain_timeout.txt
}
export -f get_title
nohup parallel --load 59% -a sort_u_domains.txt get_title &
parallel --timeout 400% --load 80% --bar -a sort_u_domains.txt get_title
vs
get_title() {
local domain=$1
local title=$(curl -sL --connect-timeout 5 "https://$domain" | grep -oP '(?<=).*(?=)')
echo "$domain,$title"
}
export -f get_title
nohup xargs -I '{}' --max-args=1 --arg-file=sort_u_domains.txt bash -c 'get_title {} >> ochesd.txt' &
xargs --max-args=1 --arg-file=sort_u_domains.txt bash -c 'echo "$@" >> samson.txt'
#one liner for one item
echo "http://www.apple.com/" | xargs -n 1 curl -sL | grep -oP '(?<=).*(?=)' | xargs -n 1 echo
#nested
ls --color=never | grep -v subdir | xargs -I{} echo "cat {}; mv {} subdir; rm subdir/{}" | xargs -I{} bash -c "{}"