Changing users email address

I just tried this (assuming that the cd /var/discourse is a line by itself and that sudo … is a separate line) and I just got the error:

-bash: syntax error near unexpected token ‘(’

Then I tried

cd /var/discourse 
sudo ./launcher enter app rails c UserEmail.find_by(email: "oid@example.com").update(email: "new@example.com")

which didn’t work and then I tried

cd /var/discourse 
sudo ./launcher enter app rails c 
UserEmail.find_by(email: "oid@example.com").update(email: "new@example.com")

(using the appropriate email addresses of course) and got the error

bash: syntax error near unexpected token `email:'

So how exactly should this be entered?