Score:0

Why we use ./ instead of just typing its name when running the script?

fk flag

when we run a normal command we just type the name of it but why we use ./ instead of just typing its name when running the script?

Score:3
jp flag

When you run a shellscript or some other program that is in the current directory, you use

./scriptname

because . denotes the current directory.

When a shellscript or some other program is in a directory in PATH, it is enough with its name for the system to find it,

program-in-path

You can watch PATH with

echo $PATH

You can put own programs into ~/bin (create your own 'bin' and put your own programs there) and it will be found by you, or put it into /usr/local/bin and it will be found by all users.

uz flag
Jos
For the sake of completeness: you could also put `.` into the `$PATH` so you never have to type `./` again, not in any directory. However, that is a security vulnerability (someone could write a malicious program called `ls` and put it in your favourite path, where it was just waiting for you to execute it) so don't do that.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.