- #!/bin/ksh93
- #
- # simple /proc/cmdline parser
- #
- compound c
- typeset -a ar
- typeset s
- typeset dummy
- ar=( $(cat /proc/cmdline) )
- compound -A c.values
- for s in "${ar[@]}" ; do
- dummy=${s/~(Elr)(.+?)(?:=(.+)|)/}
- print -v .sh.match
- case "${#.sh.match[*]}" in
- '2')
- c.values[${.sh.match[1]}].name="${.sh.match[1]}"
- ;;
- '3')
- c.values[${.sh.match[1]}].name="${.sh.match[1]}"
- c.values[${.sh.match[1]}].value="${.sh.match[2]}"
- ;;
- *)
- print -u2 -f $"%s: Parser error\n" "$0"
- ;;
- esac
- done
- print -v c
- # EOF.
SImple Linux kernel boot args (/proc/cmdline) parser
Posted by Anonymous on Tue 10th May 2022 14:58
raw | new post
view followups (newest first): SImple Linux kernel boot args (/proc/cmdline) parser by Anonymous
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.