Closed KernelGhost closed 2 months ago
Great PR. However I am not sure about the 2 point, because I don't see how/why this is better.
@LDprg It is recommended to use arrays for command construction, particularly when dealing with potentially complex or dynamically generated commands. In this context, command construction using arrays provides two main advantages:
$MULTI_FLAG
).Although there are additional benefits related to preventing injection vulnerabilities, these are less relevant in this particular scenario.
For improved readability and clarity, the section of concern can be rewritten as follows:
COMMAND=(
"${FREERDP_COMMAND}" # FreeRDP Command/Executable
"/d:${RDP_DOMAIN}" # Remote Desktop Connection Domain
"/u:${RDP_USER}" # Username
"/p:${RDP_PASS}" # Password
"/scale:${RDP_SCALE}" # Remote Desktop Session Scaling Factor
"+dynamic-resolution" # Enable Dynamic Resolution Adjustment
"+auto-reconnect" # Enable Automatic Reconnection on Disconnect
"+home-drive" # Map User Home Drive
"/wm-class:\"Microsoft Windows\"" # Window Manager
"/v:${RDP_IP}" # Virtual Machine IP Address
)
virsh list
withvirsh list --state-running --name
to directly filter for running VMs by name.grep
command togrep -q '^RDPWindows$'
for precise matching of the VM name using a regular expression.