From ce024bef27e43b2bf853268f1de4ea7aa1387d4e Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Wed, 19 Oct 2022 21:57:00 -0700 Subject: [PATCH] Created SC2083 (markdown) --- SC2083.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 SC2083.md diff --git a/SC2083.md b/SC2083.md new file mode 100644 index 0000000..5966363 --- /dev/null +++ b/SC2083.md @@ -0,0 +1,30 @@ +## Don't add spaces after the slash in './file' + +### Problematic code: + +```sh +gcc -o myfile file.c +./ myfile +``` + +### Correct code: + +```sh +gcc -o myfile file.c +./myfile +``` +### Rationale: + +Contrary to popular belief, there is no command or syntax `./` that runs a file. + +`./myfile` is simply the shortest path equivalent to `myfile` that specifies a directory and therefore causes a shell to run it as-is, instead of trying to find its directory using $PATH. + +Therefore, to run a file in the current directory, use `./myfile` and not `./ myfile`. + +### Exceptions: + +None + +### Related resources: + +* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc! \ No newline at end of file