Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9049235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T12:20:45+00:00 2026-06-16T12:20:45+00:00

I read this line of script in book [linux device drivers]. What does it

  • 0

I read this line of script in book [linux device drivers]. What does it do?

major=$(awk "\\$2=  =\"$module\" {print \\$1}" /proc/devices)

as in context:

#!/bin/sh
module="scull"   
device="scull"  
mode="664"

# invoke insmod with all arguments we got  
# and use a pathname, as newer modutils don't look in . by default

/sbin/insmod ./$module.ko $* || exit 1


# remove stale nodes  
rm -f /dev/${device}[0-3]   

major=$(awk "\\$2=  =\"$module\" {print \\$1}" /proc/devices)

mknod /dev/${device}0 c $major 0
....
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T12:20:47+00:00Added an answer on June 16, 2026 at 12:20 pm

    I read this too but that line was not working for me. I had to modify it to

    major=$(awk "\$2 == \"$module\" {print \$1}" /proc/devices)
    

    The first part \$2 == \"$module\" is the pattern. When this is satisfied, that is, the second column is equal to “scull”, the command print \$1 is executed which prints the first column. This value is stored in the variable major.
    The $ needs to be escaped as they need to be passed as it is to awk.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have part of my script that goes like this: while read line do
I read this typedef line in a C++ book, but I couldn't resolve its
count_record=file.readline() count_prev=count_record[:-1] , i used this to read the previous line and it worked
I bumped into the following problem: I'm writing a Linux bash script which does
The program that I am writing needs to do this: read every line of
I got this line in my script, which check the items class: $('#post').attr('class'); Is
I'm trying to debug my first R script and I came across this line:
Hi guys i have this line of code in a perl script where i
I read this already and wrote this script to fetch body for emails in
I read this question in stackoverflow. The excerpt answer provided by bbum is below:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.