I implemented a small python function for current_datetime and pasted it into a bash script.
$ current_datetime
2017-08-29 12:01:18.413240
I later assigned it to a variable
$ DT=$(current_datetime)
What can i call
$ echo $DT
2017-08-29 12:03:48.213455
But if I run the next line several times, I get the same results (note the same decimal part of the seconds in bold )
$ DT=$(current_datetime) | echo $DT
2017-08-29 12:04:42.**544683**
$ DT=$(current_datetime) | echo $DT
2017-08-29 12:04:42.**544683**
$ DT=$(current_datetime) | echo $DT
2017-08-29 12:04:42.**544683**
In turn, when I use &&instead |, I got the exact time when the button was pressed Enter. Why?
$ DT=$(current_datetime) && echo $DT
2017-08-29 12:21:**11.564654**
$ DT=$(current_datetime) && echo $DT
2017-08-29 12:21:**13.522406**
$ DT=$(current_datetime) && echo $DT
2017-08-29 12:21:**14.744963**
What is the difference between |and &®arding its implementation on the same command line and the exact moment of their execution?