0

I've been trying to write a really simple bash script as follows:

#!/bin/bash
gcc –Werror –std=c99 client.c –o client
gcc –Werror –std=c99 server.c –o server

Each of the commands works fine when input manually, but from the scripts it treats each of the flags as a standalone command, resulting in the following output:

[elad@localhost HW1]$ ./compile
gcc: –Werror: No such file or directory
gcc: –std=c99: No such file or directory
gcc: –o: No such file or directory
gcc: –Werror: No such file or directory
gcc: –std=c99: No such file or directory
gcc: –o: No such file or directory
[elad@localhost HW1]$

I'm using a weird specialized RedHat distro provided by my university.

1 Answer 1

6

In

gcc –Werror

this character: is not a dash (-), but an en-dash.

Replace that and/or use a different editor.

1
  • 1
    That's what I get for copy&pasting code from a PDF. I can't believe I overlooked that! Silly me! Thanks!
    – Elad Avron
    Apr 23, 2016 at 11:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .