One AI command, several shell interpretations
A filename can change what a command means. Check spaces, brackets and quoting, and distinguish the intended command from the arguments an AI agent actually passes.
Article language: English

In this article
plan zajęć.txt is one filename. A program launched by an agent may nevertheless receive two arguments: plan and zajęć.txt. The command may be syntactically valid and the report may still show exit code zero. Yet the program received different data from what was agreed.
A shell is a program that interprets command text, such as Bash. Between the user's request and the action that runs, it may expand a variable, find files matching a pattern or evaluate an expression. When accepting an agent's work, check the arguments the program actually received. The appearance of a command in a conversation does not answer that question.
The original Polish article was accompanied by a small controlled trial in a separate directory with artificial files. The program only printed the arguments it received; it did not move or delete material or use the network. The trial used Bash 3.2.57 on macOS and Node.js 24.22.1. This is evidence for that trial, not an assessment of every shell, agent tool or operating system.
What actually reached the program
In the first pair of trials, plan zajęć.txt was the value of a variable. When that variable's expansion was left unquoted, the program received two arguments. With the expansion inside double quotes, it received one argument with the space preserved. The document's contents did not change. The boundary between the data passed to the program did.
The second pair used the filename wersja[1].txt. A file named wersja1.txt had deliberately been placed in the same directory. Without appropriate quoting of the expanded variable, the program received that second name. The brackets were treated as part of a filename matching pattern. With the variable in double quotes, the program received the literal name wersja[1].txt.
The result could mislead someone who checked only the number of arguments: there was one in both cases, but its value differed. Acceptance therefore needs to compare the exact names too, rather than merely establish that the command "received a file". With similar documents, a wrong selection may look more plausible than a complete failure to run.
The control program must show the list of arguments it actually received. Having the agent print the text it intends to execute is insufficient: that omits the very interpretation step being checked. In the original trial, the list was recorded as data with separate entries. There was no need to guess whether a space on screen separated two arguments or belonged to one name. A display that simply joins everything into a sentence might look similar in both cases.
The set of files is part of the trial conditions as well. The bracket pattern produced a match because a suitable filename without brackets existed. In a directory without that file, the outcome could differ, depending also on shell settings. A repeat should preserve the controlled pair rather than use an arbitrary folder of current documents.
The Shell Expansions section of the Bash manual describes the order of expansion, word splitting and filename matching. Some of those stages can increase the number of resulting words. The final argument list need not look like the initial text.
In a company's work, filenames containing spaces and brackets are ordinary cases. They can come from a customer, an export program or someone saving another version. Requiring everyone to use only short names without spaces forever shifts responsibility for launching programs onto the document workflow. If a process restricts names, those limits should be explicit; they cannot replace checking execution.
The directory path matters too. Even a correctly prepared filename can be passed incorrectly if a parent folder's name contains a space. Distinguish those levels in the control material. The agent should preserve the entire agreed document path, not just its final component.
Double quotes do not mean "stop interpreting everything"
A further trial used the artificial filename pomiar-$((2+3)).txt. The expression contains only harmless addition of two numbers. When the name was pasted directly into the command text inside double quotes, Bash performed that calculation. The program received pomiar-5.txt. The quotes preserved one argument, but not its intended literal content.
When exactly the same name was passed as a variable's value and that variable's expansion was then double-quoted, the program received the literal addition expression in the name. This distinction matters. The shell does not automatically treat every variable value as fresh command text to interpret again. The different effect arose from assembling the whole command earlier.
The Bash manual's description of double quotes identifies characters that retain a special meaning, including the dollar sign and the command substitution character. Wrapping arbitrarily assembled text in double quotes does not turn it into literal data.
During review of the original article, one more control variant was added. The name containing the addition expression was serialized with JSON.stringify, and the resulting text was appended to a command. The result was again pomiar-5.txt. The JSON representation had valid quotes for its own format, but did not preserve the name as literal data when Bash interpreted it. It is not a general function for preparing shell arguments. Formatting data and preparing executable text solve different problems.
This does not yield a simple instruction to "replace double quotes with single quotes everywhere". The data may contain an apostrophe, and the command may pass through several layers of software. The solution must suit the particular interpretation boundary. Someone accepting the process should be able to identify where the constructed command text ends and a separate argument begins.

Also check whether the interface's presentation matches the actual invocation. A tool may display a convenient shortened command but launch the program with an argument list. It may also display an apparently orderly list, then join it back into text and pass it to a shell. The conclusion must concern the execution path, not just a picture of a terminal.
An Aeneia Audit operational review can separate the agent's intention, data passed to a tool and a confirmed effect. For commands, this distinction helps identify whether an error arose in selecting the action, preparing arguments or later interpretation. A specialist security assessment of the implementation requires a separate scope and appropriate expertise.
A separate argument list removes one layer, not every question
In the direct variant, the program was launched with a separate argument list and no intermediary shell. The name pomiar-$((2+3)).txt arrived unchanged. This demonstrates the difference in that particular path. It does not mean every program launched in this way will safely accept every value.
The Node.js documentation distinguishes exec from execFile: the former runs a command in a shell, whereas the latter launches a program without first creating a shell by default. The documentation notes platform differences, including the handling of bat and cmd files on Windows.
The target program can still interpret a received filename as an option. A file beginning with a hyphen therefore requires a separate check of the tool's behaviour. Quoting it may preserve one argument without giving that argument the role of an ordinary path. The original trial included such a filename as control material, but did not perform operations on it with a copying or deletion tool.
OWASP recommends separating data from commands and validating arguments. It also identifies argument manipulation: preventing an additional command does not establish that a value will be interpreted as intended. The target program contributes meaning too.
If a tool supports an end-of-options marker, that marker may be part of a correct invocation. Confirm support in that program's documentation. Do not treat two hyphens as a universal safeguard for every operation. Similarly, a separate argument list does not establish that the correct file, destination directory and permitted action were selected.
When accepting an AI-prepared ZIP archive (in Polish), the container's contents and the interpretation of paths stored inside it add another boundary. Passing the archive's name correctly does not prove that extraction will preserve the agreed limits. Keep those as separate checks rather than promising both through one statement that "the path was quoted correctly".
Approval concerns the action that will actually run
An approval button may show "prepare a copy of this document". If a later stage turns one path into two or matches another file, execution exceeds that decision. Human approval of AI actions (in Polish) must remain connected to a specific operation. Here, the question is whether that connection survives command interpretation.
Do not require every decision-maker to analyse an entire shell syntax manually. In a well-designed process, they can see a recognisable document, action and destination while execution preserves those as data. A tool allowing arbitrary command text creates a different decision scope and requires different expertise from a closed "copy the selected file" function.
An agent sandbox (in Polish) limits where actions may occur. It does not automatically correct interpretation. The wrong file can also be selected within an allowed directory. Conversely, correct arguments do not establish that the environment's access is narrow enough. Acceptance should preserve both boundaries.
Record which program actually ran as well as the command's name. The control set identified a specific argument-printing program rather than a coincidental tool found under a similar name. If the executor later changes the target program or runs a different version, the old result should not independently validate the new path. Argument checking must concern the invocation the agent will actually use.
Preserve the trial conditions: operating system, shell, tool version, directory and control names. Record the received argument list and the operation's outcome where that operation was actually performed. Every invocation in the original trial ended with code zero, although some changed the boundary or content of an argument. An exit code confirms the program's behaviour under its own rules, not the whole action's agreement with the user's instruction.
If a corrected launch method produces a new script version, tie review to the current change (in Polish). Repeat the cases affected by that change. Success for a short name without spaces does not close a problem exposed by a name containing brackets. Writing down a better command is not a result of checking it either.
An AI-prepared test report (in Polish) should also preserve what the trial does not prove. An argument-printing program confirms argument boundaries and values. It does not confirm that a copy was created or a file accepted by another system. If acceptance includes that action, the executor should separately check its result on designated material and compare the contents.
Before such an operation, establish what happens if the destination already exists. Even a correct path does not decide whether a file should be replaced, skipped or saved under another name. "Prepare a copy" needs that decision regardless of quoting. The evidence should show the actual resulting file and the effect on any previous item. That is an additional scope the argument printout did not cover.
Finally, the report should support a decision: allow a particular invocation, restrict it to known data or return the mechanism for correction. The boundary is immediately visible in the sample. plan zajęć.txt must arrive as one exact name. If the space disappears along the way, the document is not what needs a lesson in tidy naming.






