I was trying to make a function that all text piped into it get put into a variable. I ran into a problem. Here is a summary so this works (prints "1").
#!/bin/bash
jkl(){
i=1
}
jkl
echo $i
But not this.
#!/bin/bash
jkl(){
i=1
}
echo hel | jkl
echo $i
What’s up with this?