mirror of
https://github.com/token2/fido2-manage.git
synced 2026-04-09 02:35:39 +00:00
Simplify and fix device name extraction
* Correclty handles when the device name ends with `)` * Drops superfluous `sed` Before: ``` ./fido2-manage.sh -list Device [1] : TOKEN2 FIDO2 Security Key(0016 ``` After: ``` ./fido2-manage.sh -list Device [1] : TOKEN2 FIDO2 Security Key(0016) ``` Signed-off-by: Ferenc Géczi <ferenc.gm@gmail.com>
This commit is contained in:
2
fido2-manage.sh
Normal file → Executable file
2
fido2-manage.sh
Normal file → Executable file
@@ -123,7 +123,7 @@ if $list; then
|
||||
echo "$command_output" | while read -r line; do
|
||||
if [[ $line =~ ^([^:]+) ]]; then
|
||||
|
||||
echo "Device [$device_count] : $(echo "${line}" | grep -oP '\(([^)]+)\)' | sed 's/(\(.*\))/\1/')"
|
||||
echo "Device [$device_count] : $(echo "${line}" | grep -oP '(?<=\()(.+)(?=\))')"
|
||||
|
||||
device_count=$((device_count + 1))
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user