I have a basic bash script that currently looks for input of a specified file as a variable and if it is blank, processes the whole directory.
if i specify a file on execution such as
script.sh file1.txt then it processes that file.
What I want and cannot figure out, is how to specify multiple files with wildcards. For example:
I guess it needs some simple loop, but I could not find any examples that matched this scenario.
When I try to do a loop, it only processes the first match.
#!/bin/bash if [ $# -eq 0 ]; then echo "no argument supplied, pulling all file from tick_tock" for i in /var/tank/tick_tock/*.txt; do cp "$i" /var/tank/awaiting/ done fi echo "you supplied $1" cp "$1" /var/tank/awaiting/