Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

test.txt has four urls in it.

urls.sh: cat test.txt | xargs -n 1

check.sh uses command-line arguments for its url variable.

In Terminal, what do I write so that all the urls can be checked with check.sh using the urls.sh? Like if I say, ./check.sh http://www.cnn.com the bash script works perfectly.

I've tried:

./check.sh ./urls.sh
./check.sh | ./urls.sh
./urls.sh | ./check.sh 
share|improve this question

1 Answer 1

xargs -n1 ./check.sh < test.txt

or

cat test.txt | xargs -n1 ./check.sh

should work if check.sh is in the current working folder (otherwise use the full path to check.sh, like /usr/local/bin/check.sh).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.