Hi
The code:
Quote:
#!/bin/bash
# Dummy list
ls -1 / >> list.txt
# Function definition
ReadFileLines() {
for i in $(cat $1)
do
$2
done
}
# Run
ReadFileLines "list.txt" "echo $i"
|
Problem: I need a method to maintain the $i variable.
In fact, actually, this variable get lost when executed.
I think that an escape can preserve this variable and permit its execution inside the function, but I've no idea about.
Any ideas?