Skip to content

Instantly share code, notes, and snippets.

@hartraft
Created November 23, 2023 13:06
Show Gist options
  • Save hartraft/c7c0c725b0a25b3ef28697e2ef630f7e to your computer and use it in GitHub Desktop.
Save hartraft/c7c0c725b0a25b3ef28697e2ef630f7e to your computer and use it in GitHub Desktop.
However, it's essential to use eval with caution because it can introduce security risks, especially if the input to eval is not sanitized properly. If the content being evaluated includes user input or external data, there's a risk of code injection. Avoid using eval with untrusted input. Here's an example of a risky use of eval:
#!/bin/bash
user_input="; rm -rf /"
# This is dangerous!
eval "echo Hello $user_input World"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment