-1

Sometimes when I make a typo in the terminal and accidentally tell Bash to interpret /, I get the output bash: /: Is a directory. Now I believe this output has to deal with the root directory or something of that sort.

But what I don't understand is that when I enter increasing amounts of forward-slashes it continues to output the same thing...

Examples

//// --> bash: ////: Is a directory

//////// --> bash: ////////: Is a directory

NerdOfCode
  • 2,498

1 Answers1

3

/ is the directory delimiter. Any string that ends in it is by definition a directory name:

example #This could be a file or directory
example/ #This is a directory in the current directory
/example/ #This is a directory in the root directory

Thus a series of /'s would be interpreted an a series of {null} directories.

ravery
  • 6,874
  • But if the directory is null, why does Bash say it is a directory rather than saying does not exist? – NerdOfCode Jan 06 '18 at 06:03
  • most likely because the directory error comes before it attempts to find the command specified. IE the argument parser gives the directory error before bash attempts to find the command – ravery Jan 06 '18 at 06:09