%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#3c3836', 'primaryTextColor': '#ebdbb2', 'primaryBorderColor': '#928374', 'lineColor': '#a89984', 'secondaryColor': '#504945', 'tertiaryColor': '#665c54', 'background': '#282828', 'mainBkg': '#3c3836', 'secondBkg': '#504945', 'tertiaryBkg': '#665c54' }}}%% flowchart LR A[ผู้ใช้ User] -->|พิมพ์คำสั่ง| B[Shell ตัวแปลคำสั่ง] B -->|Parse + Expand| C{ประเภท?} C -->|Builtin| D[ทำงานในตัว Shell] C -->|External| E[fork+exec] C -->|Script File| F[อ่านบรรทัดต่อบรรทัด] F --> B D --> G[ผลลัพธ์] E --> G
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#3c3836', 'primaryTextColor': '#ebdbb2', 'primaryBorderColor': '#928374', 'lineColor': '#a89984', 'secondaryColor': '#504945', 'tertiaryColor': '#665c54', 'background': '#282828', 'mainBkg': '#3c3836' }}}%% flowchart TD P[Parent Shell] --> M{วิธีรัน?} M -->|./script.sh| S1[Spawn Subshell] M -->|bash script.sh| S2[Spawn Subshell ระบุ interpreter] M -->|source script.sh| S3[รันใน Shell ปัจจุบัน] S1 --> R1[Variable หายไปเมื่อจบ] S2 --> R1 S3 --> R2[Variable คงอยู่ใน Shell หลัก]
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#3c3836', 'primaryTextColor': '#ebdbb2', 'primaryBorderColor': '#928374', 'lineColor': '#a89984', 'secondaryColor': '#504945', 'tertiaryColor': '#665c54', 'background': '#282828', 'mainBkg': '#3c3836' }}}%% flowchart TD Start([เริ่ม]) --> C{เงื่อนไข} C -->|true exit 0| T[คำสั่งใน then] C -->|false non-zero| E[คำสั่งใน else] T --> End([จบ]) E --> End
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#3c3836', 'primaryTextColor': '#ebdbb2', 'primaryBorderColor': '#928374', 'lineColor': '#a89984', 'secondaryColor': '#504945', 'background': '#282828', 'mainBkg': '#3c3836' }}}%% flowchart TD F1[เริ่ม init] --> F2{มี item ถัดไป?} F2 -->|ใช่| F3[ทำคำสั่ง] F3 --> F2 F2 -->|ไม่| F4[จบ]
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#3c3836', 'primaryTextColor': '#ebdbb2', 'primaryBorderColor': '#928374', 'lineColor': '#a89984', 'secondaryColor': '#504945', 'background': '#282828', 'mainBkg': '#3c3836' }}}%% flowchart TD A[Start deploy] --> B[Preflight ตรวจ deps] B --> C[Build artifact] C --> D[Upload via rsync] D --> E[Activate symlink] E --> F[Restart service] F --> G{Health check?} G -->|Pass| H[Cleanup old] G -->|Fail| I[Rollback] H --> J[Done ✓] I --> K[Exit 1 ✗]