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:


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?


Question regarding that exercise:

Is it the same when I:

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

I’m a newbie so I might not be completely accurate but I think I have the gist of it.
The script.sh command that you make in this part is saved in the “/home/ccuser/workspace/learn-bash-scripting-introduction” directory and you can see it with “pwd” in the command line tab. If you also use “ls” you can see that the file called “script.sh” is in it, which contains your custom command.
Something that isn’t clear in the course (or I just didn’t notice) is that “./” is your current directory and “…/” is its parent directory (the one it belongs to)
So essentially by writing “./script.sh” you “show” the command line that file and “tell” it to run it.
For the same reason if you left that directory ("/home/ccuser/workspace/learn-bash-scripting-introduction") you wouldn’t be able to use “./script.sh” and you would have to specify the directory by writing “/home/ccuser/workspace/learn-bash-scripting-introduction/script.sh” or some other variation of that line that “points” to the same file.
As for the other commands that work without writing the full directory (like “pwd” or “ls”) I’m not sure. It might have to do with the fact that they are saved in a directory that belongs to PATH or they might have an alias so you don’t have to write the full directory every time, but I’m certain there are ways to write commands that work like that (just by name)
Hope that helps.

SOS nothing happens on Terminal - what have to be put in Terminal ???


This lesson gives the file name of the file that is opened to load the configuration on two different platforms:
Linux ~/.bashrc
OSX ~/.bash_profile
What about windows running git bash?