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 () 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 () below!
Agree with a comment or answer? Like () to up-vote the contribution!
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.
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 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?
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.
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?
Windows doesn’t work with git bash. it has it’s own command line interface. when i started this course there was a video about it but a can"t find it back
When I run ./script.sh nothing happens… shouldn’t the bash terminal out “Hello Codecademy!” because the echo command is in my script? Am I running the script incorrectly?
I was having trouble in this step but then figured out that I needed to run the ./script.sh in the bash terminal. Some lessons do not explain well enough. It feels like we are missing info.
Is there something wrong here? Or this is the expected output?
There is really nothing in the tutorial mentioning this error and I am following all the steps…
Thanks! it works! it’s really strange, the whole Command line section is quite badly-designed and confusing. You need some external information to understand the concept…