From: Victor Lowther Date: Fri, 13 Feb 2009 12:41:32 +0000 (-0800) Subject: [PATCH 02/50] Add a simple getarg function. X-Git-Tag: 0.1~476 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=047891955e9039ea4242c941d6c4bc617528226a;p=platform%2Fupstream%2Fdracut.git [PATCH 02/50] Add a simple getarg function. If we ever need to get more than one kernel command line argument, this function will pay for itself. It relies on a feature of the way bash handles string comparisons in [[ ]] statements -- the RHS is matched according to globbing rules, and is not a straight string match. --- diff --git a/init b/init index eb8998d..b5b0b1b 100755 --- a/init +++ b/init @@ -14,6 +14,12 @@ emergency_shell() bash < /dev/console } +getarg() { + for o in $(< /proc/cmdline); do + [[ $o == $1 ]] && { echo $o; break; } + done +} + echo "Starting initrd..." export PATH=/sbin:/bin:/usr/sbin:/usr/bin export TERM=linux