-2

I have this Bash script:

#!/bin/bash

while read -r line; do
    ip="$line"
    torify ./PRET/pret.py $ip pjl -q -i ./commands.txt
done < "./potential_bros.txt"

Why do I get this error?

commands.txt=

print ./message.pdf
display Completed
quit

potential_bros.txt = my ip

PRET = https://github.com/RUB-NDS/PRET

  • I can't reproduce your error. – Benjamin W. Dec 26 '18 at 20:30
  • I can't reproduce it neither. I added an answer to prove it to you . Aaalol, please be sure to include exact examples in your questions; if we don't have exact code that causes the error, we can't help. – erik258 Dec 26 '18 at 20:34
  • Might be a duplicate of [Why is a shell script giving syntax errors when the same code works elsewhere?](https://stackoverflow.com/questions/31886144/why-is-a-shell-script-giving-syntax-errors-when-the-same-code-works-elsewhere) – that other guy Dec 26 '18 at 20:39

1 Answers1

0

I fail to reproduce this error. Example that works:

$ cat t.sh
while read -r line ; do
  echo $line
done  < t.txt

$ cat t.txt
item1
item2
item3

$ ./t.sh
item1
item2
item3
erik258
  • 14,701
  • 2
  • 25
  • 31
  • @AaalolGimenezGimenez That edit doesn't make anything clear to me. Would you mind adding a few words explaining it? – Benjamin W. Dec 26 '18 at 23:31
  • the code tries to enter a py file that enters the printer with the ip of the printer that is in potential bros.txt and enters command.txt to print message.pdf – Aaalol Gimenez Gimenez Dec 27 '18 at 12:37
  • @AaalolGimenezGimenez, it doesn't matter what is in `commands.txt`, a file path argument passed to `torify`. The reason your script doesn't work is not the syntax you're using; that's my point. – erik258 Dec 27 '18 at 16:28