2 ms·
noob question: what does an \ at the end of a bash script do? Is it the same as ; ?
by b0re 6y ago
noob question:
what does an \ at the end of a bash script do? Is it the same as ; ?
- oddeyed 6y agoThe 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.
- newswasboring 6y agoOh... 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.
- jtylr 6y agoThe 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.
- liuyong 6y agoIn 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.