sf 스크립트 작성법 설명 1. "m : 경로;": 파일을 생성할 기본 경로를 설정합니다. 다음에 오는 모든 파일과 디렉토리는 이 기본 경로를 기준으로 생성됩니다. 2. "f : 파일명;": 파일을 생성합니다. 파일명은 생성할 파일의 상대 경로를 의미합니다. 기본 경로를 기준으로 생성됩니다. 파일명에 하위 디렉토리를 포함하면 해당 디렉토리가 없으면 자동으로 생성됩니다. 3. "c[파일명] : 코드;": 파일 내용을 덮어씁니다. [파일명] 부분에 덮어쓸 파일의 상대 경로를 지정하고, 코드 부분에는 파일에 덮어쓸 내용을 작성합니다. 4. ";": 세미콜론은 하나의 명령이 끝났음을 나타냅니다. 각 명령은 세미콜론으로 구분됩니다. 5. '*' : Annotation. 6. 'l : true' : When writing at the beginning of the code, 'log.txt' is generated. 예시 아래는 예시 sf 스크립트입니다. ``` m : D:\desktop\python\Hello, world!; f : main.py; c[main.py] : --! print("Hello, world!") --!; ``` 위의 예시 스크립트는 다음과 같이 동작합니다: 1. D:\desktop\python\Hello, world! 폴더를 기본 경로로 설정합니다. 2. 아래의 파일(들)을 생성합니다: main.py 3. 파일(들)에 코드를 덮어씁니다: - main.py ``` print("Hello, world!") ``` 다른 예시입니다. ``` m: C:\wockspace\hello_world_node_web; f: main.js; f: index.html; f: package.json; c[main.js]: --! const express = require("express"); const express_app = express(); express_app.get("/", (_, res) => { res.sendFile("index.html", { root: __dirname }); }); express_app.listen(8080); --!; c[index.html]: --!

Hello, world!

--!; c[package.json]: --! { "name": "hello_world_node_web", "scripts": { "start": "node main.js" }, "license": "_", "dependencies": { "express": "^4.18.2" } } --!; ``` 위의 예시 스크립트는 다음과 같이 동작합니다: 1. C:\wockspace\hello_world_node_web 폴더를 기본 경로로 설정합니다. 2. 아래의 파일(들)을 생성합니다: main.js index.html package.json 3. 파일(들)에 코드를 덮어씁니다: - main.js ``` const express = require("express"); const express_app = express(); express_app.get("/", (_, res) => { res.sendFile("index.html", { root: __dirname }); }); express_app.listen(8080); ``` - index.html ```

Hello, world!

``` - package.json ``` { "name": "hello_world_node_web", "scripts": { "start": "node main.js" }, "license": "_", "dependencies": { "express": "^4.18.2" } } ``` 각 명령은 세미콜론으로 구분되므로, 명령을 추가하려면 새로운 줄에 해당 명령을 작성하고 세미콜론으로 끝내면 됩니다. 하지만 “m:” 또는 “f:”로 쓰면 오류가 발생한다는 점을 기억하세요. “m : ” 및 "f : "로 공백까지 정확하게 넣어야 작동합니다.