September 13, 201510 yr 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 Basictest.zip
September 13, 201510 yr 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.
September 13, 201510 yr 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
September 13, 201510 yr it works fine from my system #!/bin/bash STRING="Hello World" echo $STRING root@Tower:~# ./bashtest.sh Hello World root@Tower:~#
September 13, 201510 yr 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.
September 13, 201510 yr Works here, Mac OSX 6.8.. and no control characters here in Textedit (like windows note pad) or Adobe Illustrator.
September 13, 201510 yr 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
September 13, 201510 yr 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
September 13, 201510 yr 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.
September 13, 201510 yr 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.
September 13, 201510 yr 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 !!!
September 14, 201510 yr 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?
September 14, 201510 yr 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.