I have script which is taking one argument ($1). So I run it like this: bash script.sh file1.txt. But when I want to substitute more files (bash script.sh *) then he only takes one file from all. How can I make it work? Should be there another script which substitute all files from folder as $1 into script.sh or is there easier way?
#!/bin/bash
sed -i '/^$/d' $@
declare -a command
while read -r line
do
[[ "$line" =~ ^secretcommand$ ]] || continue
read -r cmd || break
eval "$cmd"
break
done<"$@"
It's not working with "$@".
Can you help me please?