[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: some variable level issues
From: |
Chris F.A. Johnson |
Subject: |
Re: some variable level issues |
Date: |
Tue, 01 Jul 2008 03:22:27 +0000 |
User-agent: |
slrn/0.9.8.1 (Linux) |
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)
.