You have a bash script that is designed to confirm whether a file exists in the current directory. However, it is not functioning correctly because some parts are missing. Your task is to fill the blanks in the code so that the script reads the name of the file as a parameter from the command line, checks if it exists, and prints 'File exists.' if it does, and 'File does not exist.' if it doesn't.
Parameters and options
Fixing a script to confirm file existence
Report a typo
Fill in the gaps with the relevant elements
#!/bin/bash
fileName=$1
[ -f "$fileName" ];then
"File exists."
echo "File does not exist."
fi ___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.