On 2008-06-29, Matt Zyzik wrote:
> bug-bash,
....
> 2. $(<file) is very useful; however, there are times when I don't
> want any newlines chopped off. So to remedy this, I do the
> following: "IFS='' read -r -d '' var < file". Firstly, is this safe
> to do, and are there any other ways? Secondly, it appears to be very
> slow compared to $(<file). Any thoughts?

var=$( cat < file; echo . )
var=${var%.}

-- 
   Chris F.A. Johnson, webmaster         <http://Woodbine-Gerrard.com>
   ===================================================================
   Author:
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
.


Reply via email to