"echo" meaning (bash scripting)

What does echo in a bash script mean?

The code I'm trying to understand says:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
for((m=0; m<1;m++))
do
	#assign the correct mechanism to run
	RMFilename=${Mechanisms[m]}

	for ((t=0; t<$nTemp; t++))
	do
		T=${WETTemp[t]}
		for ((x=0; x<$nCO; x++))
		do
		pCO=${WETCO[x]}
		pH2=$(echo "scale=3;(100 - $pCO)" | bc)

		xH2=$(echo "scale=3; $pH2*(100 - $xAr - $xWH2O - $x0CO2)/100"	| bc)
		xCO=$(echo "scale=3; $pCO*(100 - $xAr - $xWH2O - $x0CO2)/100"	| bc)
		
		fuel="H2:$xH2, H2O:$xWH2O, CO:$xCO, CO2:$x0CO2, N2:$xAr"
		caseName=$pH2"H2-"$pCO"CO-"$T
		#echo $fuel $T $Pressure $RMFilename "$caseName"
		echo "$caseName"		
		dist/Release/GNU-Linux-x86/pa-sofc "$fuel" $T $Pressure $RMFilename "$caseName"
		done
		
	done
done
The echo command takes its arguments and prints them to standard output, then exits. In the above script, the output of the echo command is being piped to the input of the bc command with the pipe operator |
I don't get it because I also don't know how does the pipe operator in this code work... I thought they had nothing to do and wanted to solve first the problem related to the echo command.
Can you explain me briefly how does this work?
Which is the meaning of the pipe operator? and bc is a command or a variable?

Thanks for your help,


Ramon
The output of the program on the left of the pipe operator becomes the input of the program on the right of the pipe operator. It can even be chained.
Topic archived. No new replies allowed.