on-internet
← Community

Manipulate kernel device name with udev rules

Stack Overflow ·

I have Bash script that takes in a KERNEL device name as an argument and outputs a new string that can be used as the new KERNEL device name. Example: bash myScript sda Output: sdaa I use custom udev rules for this purpose. I am not sure how to pass an argument into a Bash script and catch the resultant output using udev rules. Here are some of the rules I have tried, KERNEL=="sda", RUN+="/bin/bash /etc/udev/myScript '%E{KERNEL}'", NAME="%c" KERNEL=="sda", IMPORT{program}="/bin/bash /etc/udev/myScript --export %k", NAME="%c" KERNEL=="sda", IMPORT{program}="/bin/bash /etc/udev/myScript --import

Comments

Sign in or sign up to comment and upvote.

No comments yet.