Created
March 28, 2025 10:33
-
-
Save bassmanitram/ce4ddf880f2957ec5e2b81bb6637c9ae to your computer and use it in GitHub Desktop.
How to process each line of a BASH pipe without having to continuously recreate the "while read loop" for commands that can't!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# EXAMPLES | |
# | |
# docker ps -q | each-line.sh docker rm @L | |
# docker images -q | each-line.sh docker rmi @L | |
# | |
while IFS= read -r line; do | |
$(echo "$@" | sed "s/@L/$line/") | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment