bash: build/envsetup.sh: line 1: syntax error near unexpected token `$'{r'' [duplicate]

Multi tool use
This question already has an answer here:
How to change Windows line-ending to Unix version [duplicate]
1 answer
I have my server running Ubuntu 18.04 LTS, I used it to host my personal stuff, stream media, bots and doing android builds. A month ago I saw some errors while executing the envsetup.sh
script that is where it prepares the environment to start the build. Link to the script. This is the output:
miguel@mike-machine:/home/builds/sources/PixysOS$ . build/envsetup.sh
bash: build/envsetup.sh: line 1: syntax error near unexpected token `$'{r''
'ash: build/envsetup.sh: line 1: `function hmm() {
I tried executing it in my other machine (Manjaro 18 KDE) and didn't have problems, thats where I have been building temporarily. I think it is a bash problem, but I sudo apt-get install --reinstall bash
, but I still get the same.
command-line bash scripts
marked as duplicate by wjandrea, karel, Thomas, Eric Carvalho, Charles Green Jan 7 at 15:06
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
How to change Windows line-ending to Unix version [duplicate]
1 answer
I have my server running Ubuntu 18.04 LTS, I used it to host my personal stuff, stream media, bots and doing android builds. A month ago I saw some errors while executing the envsetup.sh
script that is where it prepares the environment to start the build. Link to the script. This is the output:
miguel@mike-machine:/home/builds/sources/PixysOS$ . build/envsetup.sh
bash: build/envsetup.sh: line 1: syntax error near unexpected token `$'{r''
'ash: build/envsetup.sh: line 1: `function hmm() {
I tried executing it in my other machine (Manjaro 18 KDE) and didn't have problems, thats where I have been building temporarily. I think it is a bash problem, but I sudo apt-get install --reinstall bash
, but I still get the same.
command-line bash scripts
marked as duplicate by wjandrea, karel, Thomas, Eric Carvalho, Charles Green Jan 7 at 15:06
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
How to change Windows line-ending to Unix version [duplicate]
1 answer
I have my server running Ubuntu 18.04 LTS, I used it to host my personal stuff, stream media, bots and doing android builds. A month ago I saw some errors while executing the envsetup.sh
script that is where it prepares the environment to start the build. Link to the script. This is the output:
miguel@mike-machine:/home/builds/sources/PixysOS$ . build/envsetup.sh
bash: build/envsetup.sh: line 1: syntax error near unexpected token `$'{r''
'ash: build/envsetup.sh: line 1: `function hmm() {
I tried executing it in my other machine (Manjaro 18 KDE) and didn't have problems, thats where I have been building temporarily. I think it is a bash problem, but I sudo apt-get install --reinstall bash
, but I still get the same.
command-line bash scripts
This question already has an answer here:
How to change Windows line-ending to Unix version [duplicate]
1 answer
I have my server running Ubuntu 18.04 LTS, I used it to host my personal stuff, stream media, bots and doing android builds. A month ago I saw some errors while executing the envsetup.sh
script that is where it prepares the environment to start the build. Link to the script. This is the output:
miguel@mike-machine:/home/builds/sources/PixysOS$ . build/envsetup.sh
bash: build/envsetup.sh: line 1: syntax error near unexpected token `$'{r''
'ash: build/envsetup.sh: line 1: `function hmm() {
I tried executing it in my other machine (Manjaro 18 KDE) and didn't have problems, thats where I have been building temporarily. I think it is a bash problem, but I sudo apt-get install --reinstall bash
, but I still get the same.
This question already has an answer here:
How to change Windows line-ending to Unix version [duplicate]
1 answer
command-line bash scripts
command-line bash scripts
edited Jan 7 at 11:59


Zanna
50.3k13133241
50.3k13133241
asked Jan 7 at 1:21


MiguelNdeCarvalhoMiguelNdeCarvalho
12
12
marked as duplicate by wjandrea, karel, Thomas, Eric Carvalho, Charles Green Jan 7 at 15:06
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by wjandrea, karel, Thomas, Eric Carvalho, Charles Green Jan 7 at 15:06
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
This is almost certainly because you saved the script with DOS-style CRLF line endings.
Ex. given a minimal script file
$ cat bad.sh
function hmm() {
cat <<EOF
Run "m help" for help with the build system itself.
EOF
}
that has been saved with DOS line endings, as shown by the file
command
$ file bad.sh
bad.sh: ASCII text, with CRLF line terminators
then
$ . ./bad.sh
bash: ./bad.sh: line 1: syntax error near unexpected token `$'{r''
'ash: ./bad.sh: line 1: `function hmm() {
but
$ dos2unix bad.sh
dos2unix: converting file bad.sh to Unix format...
$ . ./bad.sh
$ hmm
Run "m help" for help with the build system itself.
You can find the dos2unix
package in the Ubuntu universe
repository - otherwise you can use sed
to remove the r
characters or vi
's set ff=unix
for example.
I just synced the repository and didnt change anything. And it is working on manjaro and on other guys's pc. If I use dos2unix I would have to use it on all scripts of the it (that are so much). Thanks
– MiguelNdeCarvalho
Jan 7 at 13:39
@MiguelNdeCarvalho you didn't mention syncing in your original question - if you are storing these scripts in a remote repository, and they are behaving differently on different machines to which you download/sync them, then I'd suggest looking first at the sync software/settings on the machines in question
– steeldriver
Jan 7 at 14:39
Hey, I am here just to say that it fixed my problem. So the problem was on the repo. Really thanks for your help :D
– MiguelNdeCarvalho
Jan 7 at 23:27
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This is almost certainly because you saved the script with DOS-style CRLF line endings.
Ex. given a minimal script file
$ cat bad.sh
function hmm() {
cat <<EOF
Run "m help" for help with the build system itself.
EOF
}
that has been saved with DOS line endings, as shown by the file
command
$ file bad.sh
bad.sh: ASCII text, with CRLF line terminators
then
$ . ./bad.sh
bash: ./bad.sh: line 1: syntax error near unexpected token `$'{r''
'ash: ./bad.sh: line 1: `function hmm() {
but
$ dos2unix bad.sh
dos2unix: converting file bad.sh to Unix format...
$ . ./bad.sh
$ hmm
Run "m help" for help with the build system itself.
You can find the dos2unix
package in the Ubuntu universe
repository - otherwise you can use sed
to remove the r
characters or vi
's set ff=unix
for example.
I just synced the repository and didnt change anything. And it is working on manjaro and on other guys's pc. If I use dos2unix I would have to use it on all scripts of the it (that are so much). Thanks
– MiguelNdeCarvalho
Jan 7 at 13:39
@MiguelNdeCarvalho you didn't mention syncing in your original question - if you are storing these scripts in a remote repository, and they are behaving differently on different machines to which you download/sync them, then I'd suggest looking first at the sync software/settings on the machines in question
– steeldriver
Jan 7 at 14:39
Hey, I am here just to say that it fixed my problem. So the problem was on the repo. Really thanks for your help :D
– MiguelNdeCarvalho
Jan 7 at 23:27
add a comment |
This is almost certainly because you saved the script with DOS-style CRLF line endings.
Ex. given a minimal script file
$ cat bad.sh
function hmm() {
cat <<EOF
Run "m help" for help with the build system itself.
EOF
}
that has been saved with DOS line endings, as shown by the file
command
$ file bad.sh
bad.sh: ASCII text, with CRLF line terminators
then
$ . ./bad.sh
bash: ./bad.sh: line 1: syntax error near unexpected token `$'{r''
'ash: ./bad.sh: line 1: `function hmm() {
but
$ dos2unix bad.sh
dos2unix: converting file bad.sh to Unix format...
$ . ./bad.sh
$ hmm
Run "m help" for help with the build system itself.
You can find the dos2unix
package in the Ubuntu universe
repository - otherwise you can use sed
to remove the r
characters or vi
's set ff=unix
for example.
I just synced the repository and didnt change anything. And it is working on manjaro and on other guys's pc. If I use dos2unix I would have to use it on all scripts of the it (that are so much). Thanks
– MiguelNdeCarvalho
Jan 7 at 13:39
@MiguelNdeCarvalho you didn't mention syncing in your original question - if you are storing these scripts in a remote repository, and they are behaving differently on different machines to which you download/sync them, then I'd suggest looking first at the sync software/settings on the machines in question
– steeldriver
Jan 7 at 14:39
Hey, I am here just to say that it fixed my problem. So the problem was on the repo. Really thanks for your help :D
– MiguelNdeCarvalho
Jan 7 at 23:27
add a comment |
This is almost certainly because you saved the script with DOS-style CRLF line endings.
Ex. given a minimal script file
$ cat bad.sh
function hmm() {
cat <<EOF
Run "m help" for help with the build system itself.
EOF
}
that has been saved with DOS line endings, as shown by the file
command
$ file bad.sh
bad.sh: ASCII text, with CRLF line terminators
then
$ . ./bad.sh
bash: ./bad.sh: line 1: syntax error near unexpected token `$'{r''
'ash: ./bad.sh: line 1: `function hmm() {
but
$ dos2unix bad.sh
dos2unix: converting file bad.sh to Unix format...
$ . ./bad.sh
$ hmm
Run "m help" for help with the build system itself.
You can find the dos2unix
package in the Ubuntu universe
repository - otherwise you can use sed
to remove the r
characters or vi
's set ff=unix
for example.
This is almost certainly because you saved the script with DOS-style CRLF line endings.
Ex. given a minimal script file
$ cat bad.sh
function hmm() {
cat <<EOF
Run "m help" for help with the build system itself.
EOF
}
that has been saved with DOS line endings, as shown by the file
command
$ file bad.sh
bad.sh: ASCII text, with CRLF line terminators
then
$ . ./bad.sh
bash: ./bad.sh: line 1: syntax error near unexpected token `$'{r''
'ash: ./bad.sh: line 1: `function hmm() {
but
$ dos2unix bad.sh
dos2unix: converting file bad.sh to Unix format...
$ . ./bad.sh
$ hmm
Run "m help" for help with the build system itself.
You can find the dos2unix
package in the Ubuntu universe
repository - otherwise you can use sed
to remove the r
characters or vi
's set ff=unix
for example.
edited Jan 7 at 2:09
answered Jan 7 at 1:41
steeldriversteeldriver
66.1k11105178
66.1k11105178
I just synced the repository and didnt change anything. And it is working on manjaro and on other guys's pc. If I use dos2unix I would have to use it on all scripts of the it (that are so much). Thanks
– MiguelNdeCarvalho
Jan 7 at 13:39
@MiguelNdeCarvalho you didn't mention syncing in your original question - if you are storing these scripts in a remote repository, and they are behaving differently on different machines to which you download/sync them, then I'd suggest looking first at the sync software/settings on the machines in question
– steeldriver
Jan 7 at 14:39
Hey, I am here just to say that it fixed my problem. So the problem was on the repo. Really thanks for your help :D
– MiguelNdeCarvalho
Jan 7 at 23:27
add a comment |
I just synced the repository and didnt change anything. And it is working on manjaro and on other guys's pc. If I use dos2unix I would have to use it on all scripts of the it (that are so much). Thanks
– MiguelNdeCarvalho
Jan 7 at 13:39
@MiguelNdeCarvalho you didn't mention syncing in your original question - if you are storing these scripts in a remote repository, and they are behaving differently on different machines to which you download/sync them, then I'd suggest looking first at the sync software/settings on the machines in question
– steeldriver
Jan 7 at 14:39
Hey, I am here just to say that it fixed my problem. So the problem was on the repo. Really thanks for your help :D
– MiguelNdeCarvalho
Jan 7 at 23:27
I just synced the repository and didnt change anything. And it is working on manjaro and on other guys's pc. If I use dos2unix I would have to use it on all scripts of the it (that are so much). Thanks
– MiguelNdeCarvalho
Jan 7 at 13:39
I just synced the repository and didnt change anything. And it is working on manjaro and on other guys's pc. If I use dos2unix I would have to use it on all scripts of the it (that are so much). Thanks
– MiguelNdeCarvalho
Jan 7 at 13:39
@MiguelNdeCarvalho you didn't mention syncing in your original question - if you are storing these scripts in a remote repository, and they are behaving differently on different machines to which you download/sync them, then I'd suggest looking first at the sync software/settings on the machines in question
– steeldriver
Jan 7 at 14:39
@MiguelNdeCarvalho you didn't mention syncing in your original question - if you are storing these scripts in a remote repository, and they are behaving differently on different machines to which you download/sync them, then I'd suggest looking first at the sync software/settings on the machines in question
– steeldriver
Jan 7 at 14:39
Hey, I am here just to say that it fixed my problem. So the problem was on the repo. Really thanks for your help :D
– MiguelNdeCarvalho
Jan 7 at 23:27
Hey, I am here just to say that it fixed my problem. So the problem was on the repo. Really thanks for your help :D
– MiguelNdeCarvalho
Jan 7 at 23:27
add a comment |
SB6845UCwKXYt,0IAWQc fXB0qEq 4UqehykFNt1xMkTygBHMz0Iv,ZAVlhCnxC2wcu zK3C LS kn,X,eOHTUc2CVX,5ghE XrD9r3Hcc