{
local DLLCONFIG="/etc/sane.d/dll.conf"
local ENTRY="kds_s2000w_net"
- local entrycheck=
[ -f "$DLLCONFIG" ] \
|| errlog "ERROR: $DLLCONFIG does not exist" \
|| return 0
echo "found $DLLCONFIG"
- entrycheck=$(cat $DLLCONFIG | grep $ENTRY)
-
- [ -n "$entrycheck" ] \
- && echo "$ENTRY entry exists in $DLLCONFIG" \
- && return 0
-
- sed -i "\$a$ENTRY" $DLLCONFIG \
+ cat $DLLCONFIG | grep $ENTRY \
+ || sed -i "\$a$ENTRY" $DLLCONFIG \
|| errlog "could not add entry $ENTRY to $DLLCONFIG" \
|| return 0
{
local DLLCONFIG="/etc/sane.d/dll.conf"
local ENTRY="kds_s2000w_net"
- local entrycheck=
[ -f "$DLLCONFIG" ] \
|| errlog "ERROR: $DLLCONFIG does not exist" \
|| return 0
echo "found $DLLCONFIG"
- entrycheck=$(cat $DLLCONFIG | grep $ENTRY)
-
- [ -z "$entrycheck" ] \
- && echo "$ENTRY entry does not exists in $DLLCONFIG" \
- && return 0
+ cat $DLLCONFIG | grep $ENTRY \
+ || errlog "$ENTRY entry does not exists in $DLLCONFIG" \
+ || return 0
sed -i "/$ENTRY/d" $DLLCONFIG \
|| errlog "could not remove $ENTRY from $DLLCONFIG" \