Created
February 27, 2015 22:42
-
-
Save deepcube/32962fdb45b93b4ac7f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Simulate add/remove events by writing directly | |
# into the uevent files. | |
if [ "$#" -ne 1 ] || [ "$1" != add ] && [ "$1" != remove ]; then | |
# warning: can't trust $0, better off just hard coding the name | |
# echo "usage: simevent add|remove" 1>&2 | |
printf "usage: %s add|remove\n" "${0##*/}" 1>&2 | |
exit 1 | |
fi | |
find /sys/devices -type f -path '*/dev' -exec \ | |
sh -c 'for f do printf %s\\n "$0" > "${f%/*}"/uevent; done' "$1" {} + |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment