#!/bin/bash

no_pipeline() {
	while true; do
		if [ $i = 0 ]; then
			break
		fi
		i=$(( i - 1 ))
	done
}
 
first_pipeline_element() {
	while true; do
		if [ $i = 0 ]; then
			break
		fi
		i=$(( i - 1 ))
	done | true
}
 
second_pipeline_element() {
	true | while true; do
		if [ $i = 0 ]; then
			break
		fi
		i=$(( i - 1 ))
	done | true
}
 
i=10
echo "[no_pipeline] start: $i"
no_pipeline
echo "[no_pipeline] end: $i"
echo
 
i=10
echo "[first_pipeline_element] start: $i"
first_pipeline_element
echo "[first_pipeline_element] end: $i"
echo
 
i=10
echo "[second_pipeline_element] start: $i"
second_pipeline_element
echo "[second_pipeline_element] end: $i"
echo