Hacker News new | past | comments | ask | show | jobs | submit login

noob question: what does an \ at the end of a bash script do? Is it the same as ; ?



The opposite. ; is the same as a newline. Prepending the newline with a backslash \ is like saying "pretend this newline isn't here". So all of the -H arguments get applied to the same command in the example, rather than being treated as commands in their own right.


Oh... I am having one of those moments where I feel like everyone else but me knew this and I'm a dummy. But when put like this, I realize \ here is an escape character thing, making the newline into \\n.


The end of a bash script or a line?

If it's at the end of the line it's just signifying that the line continues underneath and to run that block as "one line". It's just escaping the newline character.


In bash '\' would escape the character behind it. In this case, newline was escaped, which means you could ignore the newline character and treat those lines as one line.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: