mirror of
https://github.com/token2/fido2-manage.git
synced 2026-04-09 10:45: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
|
echo "$command_output" | while read -r line; do
|
||||||
if [[ $line =~ ^([^:]+) ]]; then
|
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))
|
device_count=$((device_count + 1))
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user