I am writing a bash script named safeDel.sh with base functionalities including:
- file [file1, file2, file3...]
- -l
- -t
- -d
- -m
- -k
- -r arg
For the single letter arguments I am using the built in function getops which works fine. The issue I'm having now is with the 'file' argument. The 'file' argument should take a list of files to be moved to a directory like this:
$ ./safeDel.sh file file1.txt file2.txt file3.txt
The following is a snippet of the start of my program :
#! /bin/bash
files=("$@")
arg="$1"
echo "arguments: $arg $files"
The echo statement shows the following:
$ arguments : file file
How can I split up the file argument from the files that have to be moved to the directory?
echo "$files"is just likeecho "${files[0]}"