Bash Scripting - File Operations in Scripts
What is wrong with this bash script snippet?
tempfile=mktemp echo $tempfile
tempfile=mktemp echo $tempfile
tempfile=mktemp sets the string 'mktemp' to the variable, not the output of the command.tempfile=$(mktemp) to execute and assign the output.tempfile is not declared is incorrect because variables do not require declaration. The echo command is missing quotes is not an error; quotes are optional here. The script lacks #!/bin/bash shebang is unrelated to the error.mktemp is not executed; it is assigned as a string -> Option D15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions