list.txt包含链接。我需要同时卷曲它们。意味着同时卷曲example.com
,abc.com
和123.com
。
mycurl() {
curl $1
}
seq 1 | parallel -j0 mycurl list.txt >> output.txt
#I've also tried
seq 1 | parallel -j0 mycurl ::: list.txt >> output.txt
#I"ve also tried
parallel -a list.txt mycurl >> output.txt
它们都并行输出--help
example.com
abc.com
def.com
答案 0 :(得分:1)
我看不到您的mycurl()
函数的要点,但是您可以按以下方式使用它:
# Declare 'mycurl()' function
mycurl() {
# list.txt can be accessed in here if you want
curl $1
}
# Make 'mycurl()' function available to processes started by 'parallel'
export -f mycurl
# Call 'mycurl()' once with each line of 'list.txt' as parameter
parallel -a list.txt mycurl {} > output.txt