2

Im having a problem with my xubuntu script. This is the script:

#!/bin/bash/
cd /
touch ~/.config/zoomus.conf
cd ~/Desktop
'home/oem/Desktop/Zoom.desktop'

This is my error:

bash: ./zoom.sh: /bin/bash/^M: bad interpreter: Not a directory

Please help me fix this. Im writing the script bc zoom wont run on here without the terminal. So im writing the script.


this is another error:

/home/oem/Desktop/Zoom.desktop: line 1: [Desktop: command not found
/home/oem/Desktop/Zoom.desktop: line 3: Video: command not found
/home/oem/Desktop/Zoom.desktop: line 4: fg: no job control
/home/oem/Desktop/Zoom.desktop: line 9: Application: command not found
/home/oem/Desktop/Zoom.desktop: line 11: x-scheme-handler/zoomus: No such file or directory
/home/oem/Desktop/Zoom.desktop: line 11: x-scheme-handler/tel: No such file or directory
/home/oem/Desktop/Zoom.desktop: line 11: x-scheme-handler/callto: No such file or directory
/home/oem/Desktop/Zoom.desktop: line 11: x-scheme-handler/zoomphonecall: No such file or directory
/home/oem/Desktop/Zoom.desktop: line 11: application/x-zoom: No such file or directory
/home/oem/Desktop/Zoom.desktop: line 12: X-KDE-Protocols=zoommtg: command not found
/home/oem/Desktop/Zoom.desktop: line 12: zoomus: command not found
/home/oem/Desktop/Zoom.desktop: line 12: tel: command not found
/home/oem/Desktop/Zoom.desktop: line 12: callto: command not found
/home/oem/Desktop/Zoom.desktop: line 12: zoomphonecall: command not found
Thomas Ward
  • 74,764
pugking
  • 23

1 Answers1

8

You have two problems: (1) Carriage returns, and (2) incorrect paths.

Carriage Returns

Your script has extra carriage returns which are messing up handling of the script, because the system is trying to execute /bin/bash^M directly - which doesn't exist, because it can't; ultimately this is because you edited the script in Windows or wrote it in Windows. This is commonly the case when you use Windows to make/edit Linux scripts. So, don't create scripts in Windows that you intend to use on Linux.

That said, you can fix the problem.

Per this post on our sister site Unix and Linux you should try this specific solution:

  • Use dos2unix to format the file better.

    1. Use dos2unix /path/to/script
    2. If that doesn't work, use dos2unix -c mac /path/to/script

At least one of these solutions should remove the ^M carriage returns from the script and it SHOULD then work as expected.

Fix your paths

After you fix the carriage returns, /bin/bash is your executable, it's not a directory. So your shebang line should be: #!/bin/bash


As for your Desktop errors (which needed to be added as an edit!):

use exo-open /home/oem/Desktop/Zoom.desktop to open the Desktop launcher file.

Thomas Ward
  • 74,764
  • which deleted the file? You need to be specific what you're executing when commenting here. – Thomas Ward Dec 15 '20 at 15:23
  • i tryed the :%s/^M$// – pugking Dec 15 '20 at 15:24
  • @pugking ah, yeah, i just confirmed that's a little messed. If you do :q! that will exit vi without saving and your file will be intact, so use dos2unix – Thomas Ward Dec 15 '20 at 15:25
  • error doing vi: E325: ATTENTION Found a swap file by the name ".zoom.sh.swp" – pugking Dec 15 '20 at 15:28
  • Skip the vi entirely - just execute :q! when you're already inside of vi - if you've already closed vi and your script is back and intact, then only focus on dos2unix - you can remove the swp file with rm .zoom.sh.swp – Thomas Ward Dec 15 '20 at 15:31
  • ok. it removed the ^M BUT still says /bin/bash no file or dir – pugking Dec 15 '20 at 15:35
  • 3
    @pugking read the second part of my answer under "Fix your paths". You've got /bin/bash/ in your shebang line, not /bin/bash – Thomas Ward Dec 15 '20 at 15:39
  • You don't need Windows to get ^M at the end of lines. I had exactly this error the other day on kubuntu 20.08 using kwrite - with a new script file it defaulted to MS-DOS style line endings (a config option somewhere I'm sure.) – B.Tanner Dec 15 '20 at 18:05
  • @B.Tanner When I've seen that behavior, it's because it detected that the file already had MS-DOS style line endings. But you can change it for the current file (Tools > End of line) or as a setting for the future (Settings > Configure Editor > Open/Save > End of line) or per file type. – David Z Dec 15 '20 at 23:51