Question: (BASH Scripting) Hello, I wrote a script in Bash that prompts the user to input a filename for it to be created, and then I

(BASH Scripting)

Hello, I wrote a script in Bash that prompts the user to input a filename for it to be created, and then I printed out to the terminal that the file has been created. However, I need to revise it so that the script will not create a file if no input is received, and I have no idea how I should re-write it. Below is the script:

#! /bin/bash

echo enter a file name:

read FILENAME

touch $FILENAME

echo $FILENAME has been created

Thank you so much for any help/information you can provide! Screenshots of the script and output is greatly appreciated.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!