Improve a bit shell scripts portability.
- Use /bin/sh: bash is not required here; - Avoid Perl regexp in grep(1): this is a GNU extension; - While here, make ReadNavigo.sh fail earlier if pn53x-tamashell fails at first invocation. Reported by: Ganael Laplanche <martymac@FreeBSD.org>
This commit is contained in:
parent
16a5fc419c
commit
27c43e8b8a
2 changed files with 8 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
cat << EOF | \
|
||||
pn53x-tamashell |\
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
ID=$(cat << EOF | \
|
||||
pn53x-tamashell |\
|
||||
grep -A1 "^Tx: 42 01 0b 3f 80" |\
|
||||
grep -o -P "(?<=Rx: 00 .. .. ).. .. .. .."|sed 's/ //g'
|
||||
sed -e '1d' -e "s/^Rx: 00 .. .. \(.. .. .. ..\).*/\1/" -e 's/ //g'
|
||||
# Timeouts
|
||||
3205000002
|
||||
# ListTarget ModeB
|
||||
|
@ -13,6 +13,11 @@ ID=$(cat << EOF | \
|
|||
EOF
|
||||
)
|
||||
|
||||
if [ -z "$ID" ]; then
|
||||
echo "Error: I was not abble to read Navigo ID" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat << EOF | \
|
||||
pn53x-tamashell |\
|
||||
awk '\
|
||||
|
|
Loading…
Reference in a new issue