Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Prints the lines of a file '$2' which contain the text '$1'.
- grepper () {
- if [ -f "$2" ] ; then
- custom_input=$(cat "$2")
- else
- custom_input="$($2)"
- fi
- printf "$custom_input\n" | while IFS= read -r grepper_line
- do
- case "$grepper_line" in
- *"$1"*)
- printf '%s\n' "$grepper_line"
- ;;
- esac
- done
- return 0
- }
- grepper "$1" "$2"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement