How to extract value of root variable from kernel commandline

ART

I want to extract the value set to the root variable in following kernel command line, I don't want to use awk column number.

console=ttyO0,115200n8 noinitrd mem=256M root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait=1 ip=none

I am able extract it using following command but it depends on the position of root variable but if that position changes it won't work

cat /proc/cmdline | awk '{print $4}' | cut -d '=' -f2

Any suggestions/hint/pointers ?

EDIT:
All answers are correct, I am accepting Aaron's answer as he was the first to reply.

Aaron Digulla

sed works better here:

cat /proc/cmdline | sed -e 's/^.*root=//' -e 's/ .*$//'

The first expression removes root= and everything before. The second one removes the next space and everything after.

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

How to extract value from table function in R

来自分类Dev

Extract value of json-like variable in bash

来自分类Dev

How to extract custom header value?

来自分类Dev

Extract value from xml file, simple example

来自分类Dev

SAS Macro to extract many variables from one variable

来自分类Dev

How can I extract text from images?

来自分类Dev

How to extract from this list of tuples and convert into this dictionary?

来自分类Dev

Excel: Get max value from variable range

来自分类Dev

Linux Kernel用按钮限制对root的访问?

来自分类Dev

How to assign callback return value to a variable in Mongoose?

来自分类Dev

How to execute a shell command with root permission from swift

来自分类Dev

How to go to root activity from any fragment by pressing back button?

来自分类Dev

How to extract NFS information from mount on Linux and Solaris?

来自分类Dev

How to extract text from PDF according to its location?

来自分类Dev

How to extract elements from html page using HtmlUnit

来自分类Dev

how to extract 'copyright status' from JPEG in C#

来自分类Dev

How to Extract Album Cover Image from MP3 file?

来自分类Dev

how to extract path from file location using shell

来自分类Dev

Retrieving the value from a Selenium Webdriver WebElement field and passing it to a java variable

来自分类Dev

How to execute a GDB command from a string variable?

来自分类Dev

Extract names from a text

来自分类Dev

How to compare values (integers) in an Array and store lowest value as a separate variable?

来自分类Dev

How can i get the value of a variable through the Super keyword?

来自分类Dev

How to get a value from keyvalue pair list?

来自分类Dev

How to get the value from ArrayList<Object> in android

来自分类Dev

How to Pass a Value From a Window to a UserControl in WPF

来自分类Dev

.htaccess将root / old / variable重定向到root / new / same_variable

来自分类Dev

找不到方法commandLine()

来自分类Dev

Extract images from .swf viewer?

Related 相关文章

  1. 1

    How to extract value from table function in R

  2. 2

    Extract value of json-like variable in bash

  3. 3

    How to extract custom header value?

  4. 4

    Extract value from xml file, simple example

  5. 5

    SAS Macro to extract many variables from one variable

  6. 6

    How can I extract text from images?

  7. 7

    How to extract from this list of tuples and convert into this dictionary?

  8. 8

    Excel: Get max value from variable range

  9. 9

    Linux Kernel用按钮限制对root的访问?

  10. 10

    How to assign callback return value to a variable in Mongoose?

  11. 11

    How to execute a shell command with root permission from swift

  12. 12

    How to go to root activity from any fragment by pressing back button?

  13. 13

    How to extract NFS information from mount on Linux and Solaris?

  14. 14

    How to extract text from PDF according to its location?

  15. 15

    How to extract elements from html page using HtmlUnit

  16. 16

    how to extract 'copyright status' from JPEG in C#

  17. 17

    How to Extract Album Cover Image from MP3 file?

  18. 18

    how to extract path from file location using shell

  19. 19

    Retrieving the value from a Selenium Webdriver WebElement field and passing it to a java variable

  20. 20

    How to execute a GDB command from a string variable?

  21. 21

    Extract names from a text

  22. 22

    How to compare values (integers) in an Array and store lowest value as a separate variable?

  23. 23

    How can i get the value of a variable through the Super keyword?

  24. 24

    How to get a value from keyvalue pair list?

  25. 25

    How to get the value from ArrayList<Object> in android

  26. 26

    How to Pass a Value From a Window to a UserControl in WPF

  27. 27

    .htaccess将root / old / variable重定向到root / new / same_variable

  28. 28

    找不到方法commandLine()

  29. 29

    Extract images from .swf viewer?

热门标签

归档