Code:
#!/bin/bash
# don't do this
#VAR1=file name
#echo "Enter a File name and press Enter:"
#read VAR1
#echo "file created: $VAR1"
#touch $VAR1
read -p 'Enter 3 file names on a line separted by blanks, please : ' file1 file2 file3
echo $file1
echo $file2
echo $file3
read "help read"
"help internalCommand" gives help on bash internalCommand.
"read" is a builtin.
For sure it will throw errors in the second line, as this line is interpreted as:
assign VAR=file
execute command "name"
if you want to assign a string containing blanks use:
var=' This is a string with some blanks in it assigned to var.'
echo $var
and: DO NOT USE CAPS for vars.
The environment vars are by convention all in caps.
Using var names ThisIsMyVar will prevent from accidentally changing a environment var.
This is much better style and much more safe!
And some remarks to bash scripting in general:
bash is a shell.
It is NOT a fully featured programming language.
It's primary goal is, to give you a reliable interface to the system.
So that you can easily start commands, deal with the ProcessManagment and so on.
And therefore has to follow the general *nix philosophy.
Blaming it therefore is a kind of shortsighted view.
It is a great programm with lots of astounding features,
to the price of strange syntax.
Keep on learning it.
The reward is very high.