- All Implemented Interfaces:
Command
Implements the 'cd' (change directory) builtin command.
-
Constructor Summary
Constructors
Constructs a new CdCommand instance.
-
Method Summary
Changes the shell's current directory and returns the new path.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
CdCommand
public CdCommand()
Constructs a new CdCommand instance. Initializes the built-in 'cd' (change directory) command.
-
Method Details
-
execute
Changes the shell's current directory and returns the new path.
- Specified by:
execute in interface Command
- Parameters:
args - The command and its arguments.
rawInput - The raw input string.
currentDirectory - The current working directory.
- Returns:
- The new current directory after execution.