mercredi 3 novembre 2021

File creation works on command line, but not in bash script

I wrote a small script to grab the headers for all websites in a given file. The script reads every line, and the command that it repeats for every line works when run on it's own. For some reason, when I run this script, I get an error that says "Warning: Failed to create file (filename): no such file or directory" for every iteration of the loop. I know it's probably some kind of a syntax error, but I can't seem to figure it out. Any help is appreciated! The script is below:

#!/bin/bash

while read line; do
    curl -X GET -i $line -o $line.txt;
done < $1



Aucun commentaire:

Enregistrer un commentaire