‘\r’: command not found – .bashrc / .bash_profile [duplicate]

This question already has answers here: running bash script in cygwin on windows 7 [duplicate] (2 answers) Are shell scripts sensitive to encoding and line endings? (14 answers) Closed 3 years ago. I have windows, using Cygwin, trying to set JAVA_HOME permanently through my .bashrc file. .bashrc: export PATH=”$JAVA_HOME/bin:$PATH” export JAVA_HOME=$JAVA_HOME:”/cygdrive/c/Program Files (x86)/Java/jdk1.7.0_05″ .bash_profile: if … Read more

How do I handle newlines in JSON?

I’ve generated some JSON and I’m trying to pull it into an object in JavaScript. I keep getting errors. Here’s what I have: var data=”{“count” : 1, “stack” : “sometext\n\n”}”; var dataObj = eval(‘(‘+data+’)’); This gives me an error: unterminated string literal With JSON.parse(data), I see similar error messages: “Unexpected token ↵” in Chrome, and … Read more

Pass a PHP string to a JavaScript variable (and escape newlines) [duplicate]

This question already has answers here: How do I pass variables and data from PHP to JavaScript? (19 answers) Closed 7 years ago. The community reviewed whether to reopen this question 5 months ago and left it closed: Original close reason(s) were not resolved What is the easiest way to encode a PHP string for … Read more

Split Java String by New Line

I’m trying to split text in a JTextArea using a regex to split the String by \n However, this does not work and I also tried by \r\n|\r|n and many other combination of regexes. Code: public void insertUpdate(DocumentEvent e) { String split[], docStr = null; Document textAreaDoc = (Document)e.getDocument(); try { docStr = textAreaDoc.getText(textAreaDoc.getStartPosition().getOffset(), textAreaDoc.getEndPosition().getOffset()); … Read more

./configure : /bin/sh^M : bad interpreter [duplicate]

This question already has answers here: Are shell scripts sensitive to encoding and line endings? (13 answers) Closed 4 years ago. I’ve been trying to install lpng142 on my fed 12 system. Seems like a problem to me. I get this error [root@localhost lpng142]# ./configure bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory … Read more

Replace a newline in TSQL

I would like to replace (or remove) a newline character in a TSQL-string. Any Ideas? The obvious REPLACE(@string, CHAR(13), ”) just won’t do it… 13 Answers 13 Actually a new line in a SQL command or script string can be any of CR, LF or CR+LF. To get them all, you need something like this: … Read more