FAQ: Learn Bash Scripting - Introduction to Bash Scripting

This community-built FAQ covers the “Introduction to Bash Scripting” exercise from the lesson “Learn Bash Scripting”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn the Command Line

FAQs on the exercise Introduction to Bash Scripting

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Step 3. requires us to use ./script.sh to run the script in the terminal.
I think I missed a crucial piece of information because I don’t remember that command being taught before.
I actually had to look at the hint to figure out what I was expected to do.
In my opinion, looking at the hints should be a last resource sort of thing, not the go-to place to receive the information that’s needed in order to complete a lesson. What am I missing here? I even checked very own list of commands and couldn’t find it there. :sweat_smile:

5 Likes

You just wrote that command, it is the path of your file, there’s nothing else going on there, not a single character

I am sorry, could you elaborate a little bit? I’m completely new to everything related to programming and just started with Codecademy about 9 days ago. Is ./script.sh not a command? Am I not commanding the CLI to run a script? Does writing the path of a file automatically run it in Bash?

It’s not automatic if you tell it. But other than that, yes, most commands are files by those names. Regular programs.

This particular lesson was extremely frustrating.

It didn’t explain the differences between the script.sh window or the bash window. There’s an entire section of the lesson explaining a chmod command that doesn’t actually get addressed or explained.

I also don’t understand why you need to type ./script.sh as opposed to just script.sh
What is the difference?

2 Likes

Question regarding that exercise:

Is it the same when I:

1: add -echo “Hello”- in the bash_profile
and
2: write a script like “./script.sh” with the -echo “Hello”- and run it on the terminal
?