Itai Bar
Itai Bar

Reputation: 757

Bash - giving parameter to function via pipeline

I'm trying to clean the file from its remarks (#example) and transfering the output to function named func, but it doesnt work. what am I doing wrong? it says something is wrong in line 3. "func command not found"

#!/bin/bash 

cut -d"#" -f1 $1 | func

function func {
    while read line; do
        echo $line
    done
}   

thanks

Upvotes: 1

Views: 42

Answers (1)

programmerjake
programmerjake

Reputation: 1824

you have to have the func definition before you can use it.

Upvotes: 4

Related Questions