Issue
#!/bin/bash
```
download()
{
local url=$1
echo -n " "
wget -nc --progress=dot $url 2>&1 | grep --line-buffered "%" | \
sed -u -e "s,\.,,g" | awk '{printf("\b\b\b\b%4s", $2)}'
echo -ne "\b\b\b\b"
echo " DONE"
}
```
file="adaway.org.txt"
echo -n "Downloading $file:"
download "https://raw.githubusercontent.com/EnergizedProtection/block/master/assets/active/filter/$file"
This is still rough but working. I just wanted to make some variables to shorten the bottom and just have my bash read from the cat file.
Solution
Your question isn't clear but it sounds like this might be what you're trying to do:
$ cat a.txt
http://google.com/foo
http://yahoo.com/stuff/bar
$ cat tst.sh
#!/bin/env bash
input="$1"
while IFS= read -r line; do
path="${line%/*}"
file="${line##*/}"
printf '\nline="%s"\n' "$line"
printf 'path="%s"\n' "$path"
printf 'file="%s"\n' "$file"
echo download "${path}/${file}"
done < "$input"
$ ./tst.sh a.txt
line="http://google.com/foo"
path="http://google.com"
file="foo"
download http://google.com/foo
line="http://yahoo.com/stuff/bar"
path="http://yahoo.com/stuff"
file="bar"
download http://yahoo.com/stuff/bar
If not then please edit your question to clarify.
Answered By - Ed Morton