다운로드하고 싶은 다양한 이미지가 있고 사용 가능한 링크가 있다고 가정해 보겠습니다.
하나씩 입력하고 싶지 않아요
wget https://images.unsplash.com/photo-1548363585-5b1241ee3b85?ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80
wget https://images.unsplash.com/photo-1556648011-e01aca870a81?ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80
어떻게 이를 달성할 수 있나요? 이러한 링크를 .txt 파일에 저장하고 for 루프를 사용하는 것은 올바른 방법이 아니라는 것을 읽었습니다.
답변1
다음과 같은 파일에 URL이 있는 경우:
https://images.unsplash.com/photo-1548363585-5b1241ee3b85?ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80
https://images.unsplash.com/photo-1556648011-e01aca870a81?ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80
그러면 당신은 달릴 수 있습니다
wget --input-file=file
@에 설명된 대로 이미지를 다운로드하려면쿠살라난다.
답변2
모든 것을 동일한 스크립트에 유지하려면 --input-file
/ -i
옵션을 읽을 수도 있습니다.stdin
wget -i - << EOF
https://images.unsplash.com/photo-1548363585-5b1241ee3b85?ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80
https://images.unsplash.com/photo-1556648011-e01aca870a81?ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80
EOF