[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with successive use of readrec
From: |
Dave Bucklin |
Subject: |
Problem with successive use of readrec |
Date: |
Mon, 22 Nov 2021 14:42:15 -0600 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
I'm trying to fetch data using successivs calls to readrec. The first
one works, but the second returns nothing in REPLY_REC. I've put
together the following example.
Am I doing something wrong, or is this an issue with readrec?
```
$uname -a
Linux hostname 4.19.0-11-amd64 #1 SMP Debian 4.19.146-1 (2020-09-17) x86_64
GNU/Linux
$echo $BASH_VERSION
5.0.3(1)-release
```
```
#!/usr/bin/env bash
readrec_path="/usr/lib/recutils/bash-builtins/readrec.so"
enable -f "$readrec_path" readrec
cat <<EOF >readrectest
%rec: State
%key: Id
Id: 1
State: MN
Capital: St. Paul
Id: 2
State: IA
Capital: Des Moines
EOF
#This outputs "Capital=St. Paul"
unset Capital
readrec < <(recsel -t State -e "Id=1" readrectest)
echo "Capital=${Capital}"
#This outputs "Capital=", expecting "Capital=Des Moines"
unset Capital
readrec < <(recsel -t State -e "Id=2" readrectest)
echo "Capital=${Capital}"
```
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Problem with successive use of readrec,
Dave Bucklin <=