LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 03-01-2013, 04:35 AM   #1
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,077

Rep: Reputation: Disabled
How-to set a parameter in the command line to be used later by a user-space script?


I understand that in the boot command line I can set parameters for the kernel and for kernel modules.

In addition, is it possible to set in the boot command line a parameter for a user space program or script?

For instance would it be possible to write something like "export LANG=fr" to be passed to some shell script after init or even rc.S is started?

Last edited by Didier Spaier; 03-01-2013 at 10:03 AM.
 
Old 03-01-2013, 07:08 AM   #2
elucches
Member
 
Registered: Jan 2011
Posts: 108

Rep: Reputation: 11
You mean you can't use /etc/rc.local nor .bashrc?
 
Old 03-01-2013, 08:03 AM   #3
a31amit
LQ Newbie
 
Registered: Feb 2013
Location: /root
Distribution: RHEL CENTOS UBUNUTU
Posts: 7

Rep: Reputation: 1
Here is the way :

Add your parameters in kernel line :

Code:
kernel /vmlinuz-2.6.18-308.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet myvalue=25
This will you can find in "/proc/cmdline" file while booting or after booting linux

Code:
[root@a31amit ~]# cat /proc/cmdline
ro root=/dev/VolGroup00/LogVol00 rhgb quiet myvalue=25
for getting values in script, you can use below mentioned code.
Code:
for params in $(cat /proc/cmdline); do
    echo $params | grep -q myvalue ;
    if [ $? == 0 ]; then
        val=$(echo $params | cut -d= -f2);
        echo "myvalue is $val";
    fi;
done
I believe this is what you want to know.
 
1 members found this post helpful.
Old 03-01-2013, 08:11 AM   #4
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,077

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by elucches View Post
You mean you can't use /etc/rc.local nor .bashrc?
Thanks for your answer.

Your question makes me think that I should have given a bit more of context

I am internationalizing Slackware's installer, thus the user should choose in which locale (s)he sees messages during the (text) installation.

There are basically two steps in the process:
(1) isolinux is used to provide the user with the ability of setting parameters in the boot command line, including which kernel to boot with (Incidentally, a that time (s)he can choose to boot an existing system instead of installing, and run testmem).
(2) Linux is booted, then the installation process occurs.

Basically I'd like that something I type in step (1) be used in step (2) so that the choice of UI's language be made really early.

PS I want to provide an internationalized installer, not several localized installers.

Last edited by Didier Spaier; 03-01-2013 at 08:26 AM.
 
Old 03-01-2013, 10:02 AM   #5
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,077

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by a31amit View Post
Here is the way
Yes, that's exactly what I was looking for, Amit, thanks a lot!

PS Oh, and I almost forgot: welcome to LQ.

Last edited by Didier Spaier; 03-01-2013 at 10:05 AM.
 
Old 03-02-2013, 05:40 AM   #6
a31amit
LQ Newbie
 
Registered: Feb 2013
Location: /root
Distribution: RHEL CENTOS UBUNUTU
Posts: 7

Rep: Reputation: 1
@Didier, Thanks a lot
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to pass command-line parameter to shell script? Kropotkin Linux - Newbie 12 07-25-2011 09:24 AM
how to pass response as command parameter? babysoft Linux - Newbie 2 03-11-2010 07:56 AM
pass parameter in command line lingyun Linux - Newbie 4 04-21-2009 10:42 PM
how to pass the parameter to command sed linux_1 Linux - Enterprise 3 10-15-2007 07:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 08:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration