msrd0
msrd0

Reputation: 8390

Why does my shell script fail with exit code 141 when running with busybox ash?

I have the following shell script, which works perfectly:

#!/bin/bash
set -exuo pipefail

event="/dev/input/$(cat /proc/bus/input/devices \
    | sed '1,/Name="SZH usb keyboard"/d' \
    | grep Handlers= \
    | head -n1 \
    | tr '=' ' ' \
    | tr ' ' '\n' \
    | grep -E '^event[0-9]+$' \
    | head -n1)"

echo "Enabling scrolllock for $event ..."
"$(dirname "$0")"/ledToggler.py "$event" scrolllock scrolllock 1 1

However, when I replace the /bin/bash with /bin/busybox ash, it stops working. I get an exit code of 141 and the following output:

+ cat /proc/bus/input/devices
+ sed '1,/Name="SZH usb keyboard"/d'
+ grep 'Handlers='
+ head -n1
+ tr ' ' '\n'
+ grep -E '^event[0-9]+$'
+ head -n1
+ tr '=' ' '
+ event=/dev/input/event4

Can you tell me what is the problem why it doesn't work with busybox ash?

Upvotes: 0

Views: 981

Answers (0)

Related Questions