report.sh is a regular file readable and writable by its owner.
Keep existing permissions and add only the owner's execute bit.
Which command is appropriate?
chmod u+x FILE adds the owner's execute bit while leaving unspecified permission bits unchanged.
Detailed explanation
chmod u+x report.shCorrect. It adds execute permission to the owner and preserves other bits.
chmod u-x report.shIncorrect. u-x removes the owner's execute bit.
chmod a=x report.shIncorrect. a=x replaces all classes with execute-only permissions.
chown u+x report.shIncorrect. chown changes ownership, not mode bits.
Try it yourself
An example you can run in a temporary verification environment.
bash -c 'f=$(mktemp); chmod 600 "$f"; chmod u+x "$f"; stat -c %A "$f"; rm -f "$f"'Expected result
所有者がrwx、グループとその他が---の権限表示Key points
- u means owner
- + means add
- x means execute
Notes
- Environment: GNU coreutils chmod/stat / 一時ファイル
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Shell function
A reusable group of commands that runs in the caller's shell context.
Positional parameter
A numbered argument or special value supplied to a script or function.
Control flow
Conditions, loops, and exit statuses determine which shell commands run.