Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Bash shell program problem with verion 6.1.2

Featured Replies

After upgrade to new unRAID OS version 6.1.2 my Bash shell is no longer work.

I have a bash shell that it worked before in Bash environment. Yesterday, my unRAID is abnormal acting, it can not write any more even my unRAID server still has a lot of spaces. then I upgrade to newer version 6.1.2, every thing is work normal again, except my bash script does not work any more, even I create very simple program call Basictest.sh ex:

#!/bin/bash

STRING="Hello World"

echo $STRING

After run this script it gives error as:

-bash: ./Basictest.sh: /bin/bash^M: bad interpreter: No such file or directory

What is possible ? Does my Bash program is corrupted ? so what I have to do for It works again .

To isolate problem, I post my script . Please run it in your unRAID server to see it works or not ? If It works with your system. So my Bash program need to be reinstall ? to do that, what command to reinstall Bash program.

Thanks in advance

Error.jpg.06d7a92a216e12aa04ce30be01d8f11f.jpg

Basictest.zip

You see

^M

this usually means the script was created or editting in windows notepad or wordpad.

 

Open it in MidnightCommander

mc

and remove all the ^M's.

  • Author

You see

^M

this usually means the script was created or editting in windows notepad or wordpad.

 

Open it in MidnightCommander

mc

and remove all the ^M's.

Thanks for reply,

I created this script by Vi .

Thanks

it works fine from my system

 

#!/bin/bash    
STRING="Hello World"
echo $STRING

 

root@Tower:~# ./bashtest.sh   
Hello World
root@Tower:~# 

  • Community Expert

I created this script by Vi .

I loaded the script that you attached and it definitely has the Windows/DOS end-of-line characters.  Even if you originally created it in vi it looks as if at some point you loaded it into a Windows text editor and then saved from that.

Works here, Mac OSX 6.8.. and no control characters here in Textedit (like windows note pad) or Adobe Illustrator.

  • Author

I created this script by Vi .

I loaded the script that you attached and it definitely has the Windows/DOS end-of-line characters.  Even if you originally created it in vi it looks as if at some point you loaded it into a Windows text editor and then saved from that.

So my BASH program in my unRAID doesn't work right ?

Could you please give me the script that work with your system ( or my simple script that it works), so I can try on my unRAID . I want to make sure unRAID Bash program not any issue, before I troubleshooting other scripts.

Thanks very much

  • Author

it works fine from my system

 

#!/bin/bash    
STRING="Hello World"
echo $STRING

 

root@Tower:~# ./bashtest.sh   
Hello World
root@Tower:~# 

Hi Scottc,

It runs ok on your system right ? Something is wrong with my unRAID Bash program ?

At this point , Do I need to reinstall Bash program ?

thanks

it works fine from my system

 

#!/bin/bash    
STRING="Hello World"
echo $STRING

 

root@Tower:~# ./bashtest.sh   
Hello World
root@Tower:~# 

Hi Scottc,

It runs ok on your system right ? Something is wrong with my unRAID Bash program ?

At this point , Do I need to reinstall Bash program ?

thanks

 

As others told you already,  you need to remove the dos line endings.  The ^M.

 

  • Community Expert

it works fine from my system

 

#!/bin/bash    
STRING="Hello World"
echo $STRING

 

root@Tower:~# ./bashtest.sh   
Hello World
root@Tower:~# 

Hi Scottc,

It runs ok on your system right ? Something is wrong with my unRAID Bash program ?

At this point , Do I need to reinstall Bash program ?

thanks

You just need to fix your script file to get rid of the ^M.

 

I usually just use the file view and file edit functions in mc (Midnight Commander). If you view or edit your file I think you will find the problem.

  • Author

it works fine from my system

 

#!/bin/bash    
STRING="Hello World"
echo $STRING

 

root@Tower:~# ./bashtest.sh   
Hello World
root@Tower:~# 

Hi Scottc,

It runs ok on your system right ? Something is wrong with my unRAID Bash program ?

At this point , Do I need to reinstall Bash program ?

thanks

You just need to fix your script file to get rid of the ^M.

 

I usually just use the file view and file edit functions in mc (Midnight Commander). If you view or edit your file I think you will find the problem.

Thanks trurl,

After download Midnight Commander then open the script I see ^M there, and after delete these characters, the script works... thanks very much. But I don't know why when I run my script to encode my video (This  script worked before) now it doesn't work any more. Time to investigate !!!

  • Community Expert

it works fine from my system

 

#!/bin/bash    
STRING="Hello World"
echo $STRING

 

root@Tower:~# ./bashtest.sh   
Hello World
root@Tower:~# 

Hi Scottc,

It runs ok on your system right ? Something is wrong with my unRAID Bash program ?

At this point , Do I need to reinstall Bash program ?

thanks

You just need to fix your script file to get rid of the ^M.

 

I usually just use the file view and file edit functions in mc (Midnight Commander). If you view or edit your file I think you will find the problem.

Thanks trurl,

After download Midnight Commander then open the script I see ^M there, and after delete these characters, the script works... thanks very much. But I don't know why when I run my script to encode my video (This  script worked before) now it doesn't work any more. Time to investigate !!!

Midnight Commander is already built-in to unRAID. Why did you download it?
  • Author

it works fine from my system

 

#!/bin/bash    
STRING="Hello World"
echo $STRING

 

root@Tower:~# ./bashtest.sh   
Hello World
root@Tower:~# 

Hi Scottc,

It runs ok on your system right ? Something is wrong with my unRAID Bash program ?

At this point , Do I need to reinstall Bash program ?

thanks

You just need to fix your script file to get rid of the ^M.

 

I usually just use the file view and file edit functions in mc (Midnight Commander). If you view or edit your file I think you will find the problem.

Thanks trurl,

After download Midnight Commander then open the script I see ^M there, and after delete these characters, the script works... thanks very much. But I don't know why when I run my script to encode my video (This  script worked before) now it doesn't work any more. Time to investigate !!!

Midnight Commander is already built-in to unRAID. Why did you download it?

Midnight Commander build in unRAID ?  Really. Anyway I just modify my bash script and fixed problem . Before upgrade my bash script work ok, but after upgrade to 6.1.2 bash environment change example set path directory in and out for HandbrakeCLI must in "".

Everything is ok now, thank you guys.

 

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.