Introduction to Bash Scripting"

We’re having an error in the lesson where the bash scripts won’t execute. Can you advise? Thanks!

Hi @mtf, thanks for looping me in. I’ll admit that I’m not familiar with this topic but let’s see what we can do :slight_smile:

I read through the threads linked and on my end, I was able to work through the exercise without a problem.

@dev3464546822, could you provide your code? Perhaps it’s related to the browser version? If you give me a timeframe of when your error occurred I can maybe even check against any active site maintenance.

Cheers,
Kenny

1 Like

Hi Kenny -

This link helped me resolve it.

I ended up using a combination of these two commands over the next few exercises… I had to run the sed command every time I saved modifications to the script, as it would add in these ‘line endings’.

Using sed Command

Remove the spurious CR characters. You can do it with the following command:

sed -i -e 's/\r$//' NAME-OF-FILE.sh

and then:
Run the following command,

:set ff=unix

to convert the formatting to unix.

I think there was an issue where there was some sort of windows ‘line endings’ instead of unix.

i also have had this problem with this exercise. The problem with mine is that it is confusing as to which terminal to enter the commands. The first step checks as done when entering the #!/bin/bash into the bash script on the right but on your screenshot above you have entered everything on the left script.sh terminal. Then no matter where i enter the echo command the second task does not check as done. It is just all very confusing and even after entering the solution it is still not at all informative. can you help?

1 Like

Hi @cmorritt1984!

I see your confusion and it seems like we should clear up which part is the code editor and which part is the terminal.

The code editor is the middle section on this webpage :

In this case, it has a file opened, called script.sh. Upon opening the exercise, it should look like: image. It has the name of the file up top and then below you see a 1 which denotes the line number. As you add more code to this file, you’ll also see more numbers.

The terminal is the section to the right of the code editor and looks like:
image

We’ve changed some of the checkpoint’s wording to be more clear and direct about which section is what.

I hope that helps :slight_smile:

Feel free to post to the forums to get help from the community!
Cheers,
Kenny

1 Like