0

Can anyone tell me what's wrong with my program pls? It seems correct to me? Tx

Program:

foo = "https://www.cs.cmu.edu/~rwh/courses/hott/notes/notes_week"
bar = "https://www.cs.cmu.edu/~rwh/courses/hott/notes/notes_week"
for i in {1..12} 
do
    foo = $bar
    foo+="$i"+".pdf"
    wget foo
done

Input:

PS E:\book> wsl ./s.sh

Output:

./s.sh: line 1: foo: command not found
./s.sh: line 2: bar: command not found
./s.sh: line 4: syntax error near unexpected token `$'do\r''
'/s.sh: line 4: `do
pxc3110
  • 243
  • 3
  • 14
  • 3
    Assignments cannot have spaces between the variable name and the value: `foo="https://www...`, and there is no `+` or `+=` operator for strings in sh. Try pasting your script [here](https://www.shellcheck.net/) to help catch common errors. – 0x5453 Jan 04 '19 at 22:03
  • 4
    I also recommend running your script through `dos2unix`. – mickp Jan 04 '19 at 22:04

0 Answers0