This script should copy all files of which the names are provided as arguments on the command line to the users home directory. If no files have been provided, the script should use read to ask for file names, and copy all file names provided in the answer to the users home directory.
if [ -z $1 ] then echo provide filenames read $FILENAMES else FILENAMES="$@" fi echo the following filenames have been provided: $FILENAMES for i in $FILENAMES do cp $i $HOME done
If I provide arguments as string - it works. But if I provide as "read $FILENAMES" - it has not working.
UPDATE After I entered the filenames as arguments it gives empty strings and did not copy files to $HOME location
[dmytro@oc1726036122 ~]$ cd Desktop/ [dmytro@oc1726036122 Desktop]$ . totmp provide filenames one two the following filenames have been provided: the following filenames have been provided: [dmytro@oc1726036122 Desktop]$