andresgongora / synth-shell

Boost your terminal, script by script
GNU General Public License v3.0
945 stars 236 forks source link

bad interpreter: No such file or directory when executing setup.sh #215

Closed Barina closed 2 years ago

Barina commented 2 years ago

Hi I followed the setup instructions on the readme.md file but setup.sh only gives me:

[roy@roy-mint repo]$ ./synth-shell/setup.sh 
bash: ./synth-shell/setup.sh: /bin/bash^M: bad interpreter: No such file or directory

I have cloned it to ~/repo and executed it from there I'm using Linux Mint 20.2

My commands history:

  525  mkdir repo
  526  cd repo
  527  git clone --recursive https://github.com/andresgongora/synth-shell.git
  528  chmod +x synth-shell/setup.sh
  529  cd synth-shell/
  530  ./setup.sh 
andresgongora commented 2 years ago

This is odd. It's complaining because of bash. Are you on Linux and is bash available?

On Mon 27 Dec 2021, 20:17 Roy, @.***> wrote:

Hi I followed the setup instructions on the readme.md file but setup.sh only gives me:

@.*** repo]$ ./synth-shell/setup.sh bash: ./synth-shell/setup.sh: /bin/bash^M: bad interpreter: No such file or directory

I have cloned it to ~/repo and executed it from there I'm using Linux Mint 20.2

My commands history:

525 mkdir repo 526 cd repo 527 git clone --recursive https://github.com/andresgongora/synth-shell.git 528 chmod +x synth-shell/setup.sh 529 cd synth-shell/ 530 ./setup.sh

— Reply to this email directly, view it on GitHub https://github.com/andresgongora/synth-shell/issues/215, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC36INXCECAUOEP3VZYQIBTUTC3TZANCNFSM5K22SYKQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

Barina commented 2 years ago

Yes Linux Mint and /bin/bash exists Just opened it in VSCode..

[roy@roy-mint bin]$ ls -l bash
-rwxr-xr-x 1 root root 1183448 Jun 18  2020 bash
andresgongora commented 2 years ago

Give me a minute. Maybe a typo has made it into the code. Brb

On Mon 27 Dec 2021, 20:53 Roy, @.***> wrote:

Yes Linux Mint and /bin/bash exists Just opened it in VSCode..

— Reply to this email directly, view it on GitHub https://github.com/andresgongora/synth-shell/issues/215#issuecomment-1001719254, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC36INQMYBLZXCU3JNR2LOTUTC73HANCNFSM5K22SYKQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

andresgongora commented 2 years ago

I can't find anything odd. I'm a bit confused because of that '^M' you get. I've never seen it before. Could you try to install synth-shell- prompt and -greeter on their own separately (the end result is the same). Maybe one complains and the other doesn't, that would be a good clue ... Hmmm

On Mon 27 Dec 2021, 21:45 Andres Gongora, @.***> wrote:

Give me a minute. Maybe a typo has made it into the code. Brb

On Mon 27 Dec 2021, 20:53 Roy, @.***> wrote:

Yes Linux Mint and /bin/bash exists Just opened it in VSCode..

— Reply to this email directly, view it on GitHub https://github.com/andresgongora/synth-shell/issues/215#issuecomment-1001719254, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC36INQMYBLZXCU3JNR2LOTUTC73HANCNFSM5K22SYKQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

Barina commented 2 years ago
[roy@roy-mint synth-shell]$ ./synth-shell/synth-shell-greeter/setup.sh 
bash: ./synth-shell/synth-shell-greeter/setup.sh: /bin/bash^M: bad interpreter: No such file or directory
[roy@roy-mint synth-shell]$ ./synth-shell/synth-shell-prompt/setup.sh 
bash: ./synth-shell/synth-shell-prompt/setup.sh: /bin/bash^M: bad interpreter: No such file or directory
[roy@roy-mint synth-shell]$ 

Maybe something is wrong with my bash? I also never see that ^M thing anywhere before and googling it suggests that there's maybe something wrong line ending characters so I tried dos2unix on it which didn't help.. output was:

[roy@roy-mint synth-shell]$ ./setup.sh 
bash: ./setup.sh: /bin/bash^M: bad interpreter: No such file or directory
[roy@roy-mint synth-shell]$ dos2unix -k -o setup.sh 
dos2unix: converting file setup.sh to Unix format...
[roy@roy-mint synth-shell]$ ./setup.sh 
user_io.sh: line 2: $'\r': command not found
user_io.sh: line 21: $'\r': command not found
user_io.sh: line 22: $'\r': command not found
user_io.sh: line 30: $'\r': command not found
user_io.sh: line 31: $'\r': command not found
user_io.sh: line 32: $'\r': command not found
user_io.sh: line 76: syntax error near unexpected token `$'\r''
'ser_io.sh: line 76: `_printBase()
Include failed /home/roy/repo/synth-shell/bash-tools/bash-tools->bash-tools/bash-tools/user_io.sh
[roy@roy-mint synth-shell]$ git checkout -- .
andresgongora commented 2 years ago

That's odd. Very odd. I've only been fixing -ss-greeter lately, but ss-prompt has been working for ages now.

Could you try running the script with /bin/bash setup.sh directly (ie force your system to use bash by bypassing the terminal) maybe that works

On Mon 27 Dec 2021, 22:08 Roy, @.***> wrote:

@. synth-shell]$ ./synth-shell/synth-shell-greeter/setup.sh bash: ./synth-shell/synth-shell-greeter/setup.sh: /bin/bash^M: bad interpreter: No such file or directory @. synth-shell]$ ./synth-shell/synth-shell-prompt/setup.sh bash: ./synth-shell/synth-shell-prompt/setup.sh: /bin/bash^M: bad interpreter: No such file or directory @.*** synth-shell]$

Maybe something is wrong with my bash? I also never see that ^M thing anywhere before and googling it suggests that there's maybe something wrong line ending characters so I tried dos2unix on it which didn't help.. output was:

@. synth-shell]$ ./setup.sh bash: ./setup.sh: /bin/bash^M: bad interpreter: No such file or directory @. synth-shell]$ dos2unix -k -o setup.sh dos2unix: converting file setup.sh to Unix format... @. synth-shell]$ ./setup.sh user_io.sh: line 2: $'\r': command not found user_io.sh: line 21: $'\r': command not found user_io.sh: line 22: $'\r': command not found user_io.sh: line 30: $'\r': command not found user_io.sh: line 31: $'\r': command not found user_io.sh: line 32: $'\r': command not found user_io.sh: line 76: syntax error near unexpected token $'\r'' 'ser_io.sh: line 76:_printBase() Include failed /home/roy/repo/synth-shell/bash-tools/bash-tools->bash-tools/bash-tools/user_io.sh @. synth-shell]$ git checkout -- .

— Reply to this email directly, view it on GitHub https://github.com/andresgongora/synth-shell/issues/215#issuecomment-1001761466, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC36INSXTSUT3XCARHKW5FDUTDIUHANCNFSM5K22SYKQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

Barina commented 2 years ago

Yes this is what I'm getting with /bin/bash

[roy@roy-mint synth-shell]$ /bin/bash setup.sh 
setup.sh: line 2: $'\r': command not found
setup.sh: line 21: $'\r': command not found
setup.sh: line 25: $'\r': command not found
setup.sh: line 26: $'\r': command not found
setup.sh: line 27: $'\r': command not found
setup.sh: line 57: syntax error near unexpected token `$'\r''
'etup.sh: line 57: `installScript()
[roy@roy-mint synth-shell]$ ./setup.sh 
bash: ./setup.sh: /bin/bash^M: bad interpreter: No such file or directory

I'm pretty sure I have something corrupted here, other scripts also showing that cartridge return symbol for me :S I tried resetting my .bashrc to the default but it's not that.. maybe my /bin/bash file is corrupted?

Barina commented 2 years ago

After banging my head in the wall for hours, I was able to run setup.sh by executing the line below in the root folder first find . -type f -print0 | xargs -0 dos2unix I still don't know why this happens.. seems like git clone cloned the files with CRLF ?? Thanks for the support! now I can play with this :P

andresgongora commented 2 years ago

This is very odd. I've been running this again through my machine (I'm currently sitting on an ArchLinux) and there is no problem at all. I've dumped the files to hex and there are no \r at all. Maybe this is helpfu?: https://superuser.com/questions/194668/grep-to-find-files-that-contain-m-windows-carriage-return

In any case, I'm glad you managed to get it working. Any feedback is most welcome :)

I'm leavng this issue open in case you find more info about the problem so we can solve it for everyone. But for now, you clone theory seems the most reasonable... so odd. Maybe the first time you run dos2unix it overwrote the setup file?

andresgongora commented 2 years ago
0000000   #   !   /   b   i   n   /   b   a   s   h  \n  \n   #   #    
0000010       +   -   -   -   -   -   -   -   -   -   -   -   -   -   -
0000020   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
0000030   -   -   -   -   -   +   -   -   -   -   -   -   -   -   -   -
0000040   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
0000050   -   -   -   -   -   -   -   -   -   +  \n   #   #           |
0000060        

All lines end with \n

Barina commented 2 years ago

Maybe this is helpfu?: https://superuser.com/questions/194668/grep-to-find-files-that-contain-m-windows-carriage-return

I tried that only on setup.sh at first but it didn't work.

The find command just passing any files under a directory to dos2unix so it changes all occurrences of ^M in all of the text files. I am sure now that my git causes this issue. there's an option on git to override line ending and you can set it globally. I've run the command git config --list and there was a core.autocrlf=true. :man_facepalming: So I removed it and removed the repo and cloned it again and now it works.

So my issue was that autocrlf was on while cloning and that causing new clones to change the line ending.

andresgongora commented 2 years ago

Great. Everyday you learn something new! hehehehe Thanks for the feedback! I'm closing this issue then. Feel free to open other issues for feature requests or if you find something else is not working as expected with synth-shell :)