help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bash read error


From: Pascal
Subject: bash read error
Date: Wed, 1 Jun 2022 12:47:32 +0200

hi,

I try to create a "on the fly" configuration file but it does not work as
expected.

it's OK if I try this :

wpa_supplicant -B -i wlan1 -c <(
cat <<~~~~
network={
...
identity="test"
password=hash:0cb6948805f797bf2a82807973b89537
}
~~~~
)

but it's KO with bash: read: read error: 0: Input/output errors if I try to
read and convert informations before "cating" configuration :

wpa_supplicant -B -i wlan1 -c <(
read -p 'user     ? ' user
read -p 'password ? ' -s passwd
cat <<~~~~
network={
...
identity="${user}"
password=hash:$( echo -n "${passwd}" | iconv -t utf16le | openssl md4 |
egrep -o '.{32}$' )
}
~~~~
)
user     ? bash: read: read error: 0: Input/output error
password ? bash: read: read error: 0: Input/output error

on the other hand, the use of a pipe is not a problem :

(
read -p 'user     ? ' user
read -p 'password ? ' -s passwd
cat <<~~~~
network={
...
identity="${user}"
password=hash:$( echo -n "${passwd}" | iconv -t utf16le | openssl md4 |
egrep -o '.{32}$' )
}
~~~~
) | wpa_supplicant -B -i wlan1 -c /dev/stdin

why doesn't it work with <( redirection/substitution ?

regards, lacsaP.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]