Final answer:
To exit a script with a code of 42, the correct command is 'exit 42'. This is a command used in shell scripting to return an exit status to the operating system.
Step-by-step explanation:
To finish your script with an exit code of 42, you would use the command exit 42. This command is used in many shell scripting environments, including bash on Linux and macOS, as well as batch scripts on Windows, to indicate the script's exit status back to the parent process or operating system. The number 42, in this context, would be an arbitrary number chosen to signify a particular exit status that can be utilized by other processes or scripts that might call or rely on this script's execution.