[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Builtin 'read' data not saved
From: |
P Fudd |
Subject: |
Builtin 'read' data not saved |
Date: |
Thu, 2 Jan 2014 11:19:20 -0800 |
User-agent: |
SquirrelMail/1.4.20-2.fc11 |
Hello all,
I'm at my wit's end. This script is not working:
=========================================
#!/bin/bash
B=none
echo "2" | while read -r A; do
B="$A"
echo 1.B=$B
done
echo 2.B=$B
==========================================
The output, from GNU bash, version 4.2.25(1)-release
(x86_64-pc-linux-gnu), bash-4.2-2ubuntu2.1.deb, is this:
1.B=2
2.B=none
I'm baffled; it's like the while loop is in a parallel universe. I tried
'export B=none' in line 2, with no effect.
Help?
--
fink@ch.pkts.ca
- Builtin 'read' data not saved,
P Fudd <=