Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
hello i have a problem in scripting , actually just started the scripting.
hope you will be able to understand it
i want to enter in running kernel,s modules directory in a script
like "/lib/modules/running kernel/driver...."
i know that "uname -r" command will print the running kernels name , and it can help me in this case
but how to use it in the script ????
thanks for your help .
sorry to say but it didnt worked.
i think my stupid mind is not able to understand it .
please if you can explain ?
i want to do "cd /lib/modules/running kernel/........"
Like he said (w/o outer quotes): "cd /lib/modules/`uname -r`/kernel" :-]
Note the backticks can also be replaced with $(), as in "cd /lib/modules/$(uname -r)/kernel" but that's coding stylee.
If you ever come across a piece of code you can't understand there's two things make it more understandable. If you run it from a script you can execute the script as "sh -x <scriptname>" which will show you all the actual values your script works with. The second thing is echoing. For the above example try on the commandline: "echo "cd /lib/modules/`uname -r`/kernel"". Notice we just put echo in front and wrap the whole command in double quotes. It should return the line which would be executed as command.
now when i read it cleared my concept that
`uname -r` = $(uname -r)
but actually the `uname -r` was case sensative and i was using like this `uname -r' which was wrong.
thanks a lot for the help of you .
this is really a helpfull site.
hello all
so this is my first script for which thisthread was created.
my problem was to load the sound module for 3 kernels in slackware.but its compatible only with new kernels
so i put these lines in /etc/rc.d/rc.local
cd /lib/modules/`uname -r`/kernel/drivers/sound/
if [ -f via82cxxx_audio.o ]; then
modprobe \*via82cxxx_audio.o
# as one kernel uses .o.gz modules
else
modprobe \*via82cxxx_audio.o.gz
fi
cd ~
a 's first script and only because of slackware.
i know this is nothing for you but for me it is
thanks again for your help.
Last edited by newpenguin; 10-07-2002 at 12:59 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.