Викторина, связанная с руководством · Средний Уровень

Как писать сценарии оболочки с помощью AI Quiz

Проверяет безопасные подсказки, пробный просмотр, цитирование оболочки, различия платформ и практические меры безопасности перед запуском сценариев, созданных ИИ.

Связанные направляющие путиКак писать сценарии оболочки с помощью ИИ
Вопрос 1 из 8

Before letting an AI-drafted cleanup script delete files, what is the safest first run?

Предварительный просмотр каждого вопроса8 вопросы

Ответы и пояснения появляются по мере прохождения теста.

  1. Before letting an AI-drafted cleanup script delete files, what is the safest first run?
    • Use a dry run on a temporary folder and inspect every proposed path
    • Run it as administrator to avoid permission errors
    • Remove all error handling so failures are obvious
    • Run it from the system root so relative paths are predictable
  2. Why should a prompt name Bash or PowerShell explicitly?
    • Both shells use identical variables but different colors
    • Their syntax and command behavior differ
    • AI cannot draft code without a shell name
    • The operating system chooses one shell for all scripts
  3. What does passing subprocess arguments as a list generally help prevent?
    • All program errors
    • The program from reading files
    • A filename being interpreted as shell syntax when no shell is invoked
    • The need to check exit codes
  4. A generated script builds a command string from a filename supplied by a user. What should you inspect first?
    • Whether the filename is long enough
    • Whether comments use full sentences
    • Whether the script has a logo
    • Whether the value can be parsed as shell metacharacters
  5. Which prompt detail most improves a file-copy script draft?
    • The operating system, shell, source and destination behavior, and overwrite rule
    • The user's favorite editor
    • A request to make the script clever
    • A request to omit assumptions
  6. A test reports success even though one copy failed. Which improvement best addresses this?
    • Print a longer completion message
    • Check command exit status and report partial failures
    • Run the same command twice
    • Hide standard error
  7. Why use the least privilege needed for a script?
    • It makes scripts shorter
    • It prevents all syntax errors
    • It limits the damage if a command or path is wrong
    • It guarantees the AI used official documentation
  8. After a script changes files, what is a useful verification step?
    • Assume the dry run guarantees the result
    • Delete the log to save space
    • Immediately rerun it with broader permissions
    • Compare changed paths with the preview and inspect sample outputs