When I'm Trying to Execute Bashscript but can't Started

When I'm Trying to Execute Bashscript but can't Started - a little story about the experience of building scripts with bash on linux, maybe you have experienced the same thing when creating scripts using notepad ++ or others, then you import them into Linux and run them, it doesn't work properly.

create bash on notepad ++
create bash on notepad ++

Fortunately there is a very helpful standard output.

bad interpreter
bad interpreter

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

Maybe because the characters in notepad ++ that I use don't work in linux itself, causing the script to not run.

To fix this is very easy to run the command below :

# sed -i -e 's/\r$//' "your_bashscript.sh // For your case
# sed -i -e 's/\r$//' test_backup.sh  // my case

And you have to believe in magic, rerun your bashscript and see what happens. try running your bashscript again, and I ask for help praying first

# ./test_backup.sh
Success hit bashscript
Success hit bashscript

Maybe that's all I can share with you guys, hopefully this article will be useful.

Thank You 

Bangkit Ade Saputra
Bangkit Ade Saputra At the end of the day, my job involves people. we're complicated, we're always changing, we have millions of things going on in our lives, and changing jobs is always a big decision.

Post a Comment for "When I'm Trying to Execute Bashscript but can't Started"