Re: Bash: read and backslashes in input file

2002-11-16 Thread Leonard den Ottolander
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

Re: Bash: read and backslashes in input file

2002-11-15 Thread Cameron Simpson
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

Re: Bash: read and backslashes in input file

2002-11-07 Thread Leonard den Ottolander
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

Re: Bash: read and backslashes in input file

2002-11-07 Thread Todd A. Jacobs
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

RE: Bash: read and backslashes in input file

2002-11-07 Thread Cowles, Steve
> -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

Bash: read and backslashes in input file

2002-11-07 Thread Leonard den Ottolander
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