Executable check.sh is in the current directory, but that directory is not in PATH.
Which specification runs the file directly?
./check.sh is a relative path from the current directory and does not rely on PATH lookup.
Detailed explanation
check.shIncorrect. Without the current directory in PATH, the bare name is not found.
./check.shCorrect. ./check.sh explicitly starts the lookup in the current directory.
/check.shIncorrect. /check.sh refers to a file directly under the filesystem root.
../check.shIncorrect. ../check.sh refers to the parent directory.
Try it yourself
An example you can run in a temporary verification environment.
tmp=$(mktemp -d); printf '#!/bin/sh\necho checked\n' >"$tmp/check.sh"; chmod +x "$tmp/check.sh"; (cd "$tmp" && ./check.sh); rm -rf "$tmp"Expected result
checkedKey points
- . means the current directory
- ./ is a relative path
- A path beginning with / is absolute
Notes
- Environment: POSIX shell / 一時実行ファイル
- Use disposable shell sessions and harmless commands for experiments.
- Shell behavior can depend on Bash options and distribution defaults.
Foundation review
Place the operation
`./name` explicitly names an entry in the current directory and bypasses PATH lookup.
Check the side effect
Verify both the current directory and executable permission before direct execution.