Home > Blockchain >  Why do I get a "no such file or directory" error in this Bash script?
Why do I get a "no such file or directory" error in this Bash script?

Time:09-21

I have this small part of bash script that gets output and writes/echos the output, but it states

./test.sh: line 24: : No such file or directory
while IFS= read -r line; do
    cat  << EOF
  - request:
      path: $line
      method: GET
    response: 
      raw_body: $res
      status: $code
EOF
done < "$1"

Why is that?

CodePudding user response:

Instead of launching sh test.sh, you should launch sh test.sh <input_file>, like this, your input parameter $1 will be filled in.

  •  Tags:  
  • bash
  • Related