Hi Cameron,
> Sure you can pipe to loops. Just remember that the loop will be in a subshell
> so any variable settings won't have effect on the main shell. Thus:
>
> a=1
> ls | while read -r file; do a=$file; done
> echo $a
>
> will say "1".
That is actually my problem. I need the variable
On 23:00 07 Nov 2002, Leonard den Ottolander <[EMAIL PROTECTED]> wrote:
| > Us raw input instead:
| > while read -r line; do echo ${line}; done < somefile
[...]
| > you will get exactly that as output. Use "help read | less" at the
| > bash command line for more info.
|
| Just the switch I wa
Hi Todd, Steve,
> Us raw input instead:
>
> while read -r line; do echo ${line}; done < somefile
>
> Then, given that somefile contains:
>
> \
> \\
> \\\
>
>
> you will get exactly that as output. Use "help read | less" at the
> bash command line for more info.
Just
On Thu, 7 Nov 2002, Leonard den Ottolander wrote:
> while read line; do echo ${line}; done < somefile
Us raw input instead:
while read -r line; do echo ${line}; done < somefile
Then, given that somefile contains:
\
\\
\\\
you will get exactly that as output. U
> -Original Message-
> From: Leonard den Ottolander
> Subject: Bash: read and backslashes in input file
>
>
> Hi,
>
> Consider the following example:
> while read line; do echo ${line}; done < somefile
> read will interpret the backslashes as escapes
Hi,
Consider the following example:
while read line; do echo ${line}; done < somefile
read will interpret the backslashes as escapes and remove them from the
input. Now I could do
sed s/'\\'/''/ somefile | while read line; do echo ${line}; done
, but this will create a subshell which is not