I need to get only first two numbers of “uname -r” command in bash
example of regular out put:
uname -r
3.5.0-18-generic
what I expect using magic bash options:
3.5
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
assuming you want everything before the second dot, this will do what you want:
uname itself does not support cutting the output, afaik. The pipe through cut will show you fields 1 and 2 (
-f1-2), delimited by dots (-d.)