I'm trying to make the Bee movie script pop up in 100 different files using this command. I keep getting this error though when I run it. Am I missing something?

Error: jacob{1..100}.txt: ambiguous redirect

$ curl -s http://www.script-o-rama.com/movie_scripts/a1/bee-movie-script-transcript-seinfeld.html \
   > jacob{1..100}.txt

You could use tee. It reads from standard input and writes to standard output and files.


$ echo foo | tee {1..10}.txt
$ ls
10.txt  1.txt  2.txt  3.txt  4.txt  5.txt  6.txt  7.txt  8.txt  9.txt
$ cat *

Also note that with that curl command you would be saving the HTML page instead of the script alone. You'll need to grab whatever is within those <pre> tags, but that's an entirely different question.

  • Thanks for the reply! I’m new to all this so this definitely helps! – moneey badger Aug 15 '18 at 2:37

You could also break this up into multiple commands since it's easier to understand when you're first starting out. For example:

download file
$ curl -s http://www.script-o-rama.com/movie_scripts/a1/bee-movie-script-transcript-seinfeld.html -O

The above will result in this file being downloaded - bee-movie-script-transcript-seinfeld.html.

replicate file to 100 copies
$ for i in {001..100}; do \
    cp bee-movie-script-transcript-seinfeld.html jacob${i}.txt; done

Resulting in these files:

$ ls
bee-movie-script-transcript-seinfeld.html  jacob021.txt  jacob042.txt  jacob063.txt  jacob084.txt
jacob001.txt                               jacob022.txt  jacob043.txt  jacob064.txt  jacob085.txt
jacob002.txt                               jacob023.txt  jacob044.txt  jacob065.txt  jacob086.txt
jacob003.txt                               jacob024.txt  jacob045.txt  jacob066.txt  jacob087.txt
jacob004.txt                               jacob025.txt  jacob046.txt  jacob067.txt  jacob088.txt
jacob005.txt                               jacob026.txt  jacob047.txt  jacob068.txt  jacob089.txt
jacob006.txt                               jacob027.txt  jacob048.txt  jacob069.txt  jacob090.txt
jacob007.txt                               jacob028.txt  jacob049.txt  jacob070.txt  jacob091.txt
jacob008.txt                               jacob029.txt  jacob050.txt  jacob071.txt  jacob092.txt
jacob009.txt                               jacob030.txt  jacob051.txt  jacob072.txt  jacob093.txt
jacob010.txt                               jacob031.txt  jacob052.txt  jacob073.txt  jacob094.txt
jacob011.txt                               jacob032.txt  jacob053.txt  jacob074.txt  jacob095.txt
jacob012.txt                               jacob033.txt  jacob054.txt  jacob075.txt  jacob096.txt
jacob013.txt                               jacob034.txt  jacob055.txt  jacob076.txt  jacob097.txt
jacob014.txt                               jacob035.txt  jacob056.txt  jacob077.txt  jacob098.txt
jacob015.txt                               jacob036.txt  jacob057.txt  jacob078.txt  jacob099.txt
jacob016.txt                               jacob037.txt  jacob058.txt  jacob079.txt  jacob100.txt
jacob017.txt                               jacob038.txt  jacob059.txt  jacob080.txt
jacob018.txt                               jacob039.txt  jacob060.txt  jacob081.txt
jacob019.txt                               jacob040.txt  jacob061.txt  jacob082.txt
jacob020.txt                               jacob041.txt  jacob062.txt  jacob083.txt

You can then delete the original file, rm -f bee-movie-script-transcript-seinfeld.html.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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