-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPwd.java
More file actions
30 lines (23 loc) · 875 Bytes
/
Pwd.java
File metadata and controls
30 lines (23 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package src;
import java.nio.file.Paths;
import java.util.Scanner;
public class Pwd {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (true) {
System.out.print("명령어를 입력하세요 (예: pwd, exit): ");
String command = scanner.nextLine();
if ("pwd".equals(command)) {
String currentDirectory = Paths.get("").toAbsolutePath().toString();
System.out.println("현재 작업 디렉토리: " + currentDirectory);
} else if ("exit".equals(command)) {
System.out.println("프로그램을 종료합니다.");
break;
} else {
System.out.println("알 수 없는 명령어입니다.");
}
}
//scanner.close();
}
}
// man pwd, ls, cd, cat