I have file which looks like following:
/usr/local/bin
/bin
/usr/bin
/usr/local/sbin
/usr/sbin
/sbin
/home/user/.local/bin
/home/user/bin
/home/user/perl5/bin
now I want to concatenate the lines by colon using while read syntax, something like this:
cat file | while read data; do path="$path:$data"; done && echo $path
but above code is not working that I am expecting, the $path variable remains empty, what is the problem?