Setting a locale in Redhat ES 4


 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Setting a locale in Redhat ES 4
# 1  
Old 05-19-2008
Setting a locale in Redhat ES 4

Hi,

I am writing a shell script which would ask user to select a locale and should set the locale for them.

In the script I am doing

export LANG=<user selected locale>

and i do 'locale' it would show me the changed locale.


But, when I come out of the program and do 'locale' it would go back to previous one.

Is there anyway I can avoid this?


Thanks,
sunny.
# 2  
Old 05-19-2008
A script cannot modify the environment of the parent process; you need to somehow invoke your command in the context of the invoking shell.

Some tools require you to invoke them with something like eval `nameoftool` and so the tool itself would simply print something like LANG=value; export LANG and leave it to the invoking user to actually do something useful with this output.
# 3  
Old 05-19-2008
When you run a script in a shell, it runs in a subshell and a parent shell can't inherit variables from a subshell.

Run your script in the current shell:

Code:
. ./scriptname

# 4  
Old 05-19-2008
Thanks a lot
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Perl error : perl: warning: Setting locale failed.

This's my problem perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LC_ALL = "en_US.UTF-8", LC__FASTMSG = "true", LC_MESSAGES = "", LC_CTYPE = "en_US.UTF-8", LC_TYPE = "en_US.UTF-8", LANG = "EN_US"... (1 Reply)
Discussion started by: bobochacha29
1 Replies

2. Red Hat

Redhat Cluster updating kernel setting

hello, I was going through clustering documentation for Redhat, it says "Enable IP Aliasing support in the kernel by setting the CONFIG_IP_ALIAS kernel option to y. When specifying kernel options, under Networking Options, select IP aliasing support", I knew I should update /etc/sysctl.conf with... (1 Reply)
Discussion started by: bobby320
1 Replies

3. Homework & Coursework Questions

Redhat LINUX 5 setting In VMWARE

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I have installed Redhat Linux 5 in VMWARE and would need to access through putty form the same desktop or... (2 Replies)
Discussion started by: SasiWipro
2 Replies

4. Solaris

setting locale en_US.UTF-8

hi, I am using SOLARIS sparc 64 bit, during installation of Oracle i receive an error required OS locale en_US.UTF-8 does not exist on the installation computer. To avoid this issue, please ensure that the locale en_US.UTF-8 exists on the installation computer prior to installing Oracle. when... (4 Replies)
Discussion started by: zeeshan047
4 Replies

5. Red Hat

Setting an alias in Redhat

Hi Everyone, I am trying to set up alias the only way I now how, buy making entry into .bashrc file. The entry I made is alias ll='ls -lrt' It is not working as I expect. When I enter "alias" at the command line I get the following. $ alias alias l.='ls -d .* --color=tty' alias... (2 Replies)
Discussion started by: jxh461
2 Replies

6. Red Hat

Setting keyboard configaration in redhat ES4

Hi, can someone tell me how to set the keyboard configaration at console in redhat Linux ES 4. I don't want it in x-windows mode. Also, how can I find all the keyboard configarations available. Thanks in advance. Sunny (0 Replies)
Discussion started by: eamani_sun
0 Replies

7. Solaris

Sol 10 on SUN V490: Setting LOCALE

Hi all, We've upgraded/migrated our production server from Sol 9 on a Sun V480 to Sol 10 on a V490 server. How do I set/change the following values on Solaris 10: Solaris 9: $> locale LANG= LC_CTYPE=en_US.ISO8859-1 LC_NUMERIC=en_US.ISO8859-1 LC_TIME=en_US.ISO8859-1... (2 Replies)
Discussion started by: dewets
2 Replies

8. Red Hat

Setting Up Routing In Linux Redhat 9 Help

:mad: I have just recently got into using Linux RedHat 9. So far I love it, I have set it up on a server I am running. Right now I have set up Samba and am running a file server for my house. I have four computers, the linux box is connected to the internet through a switch I have. There are two... (5 Replies)
Discussion started by: xTHESEUSx
5 Replies

9. UNIX for Dummies Questions & Answers

Solaris 8 locale setting

Hello does anybody know how to change the LC_TIME locale on solaris 8 to dd/mm/YYYY currently it is set to. #locale -ck LC_TIME d_fmt="%m/%d/%y" Thanks (1 Reply)
Discussion started by: thangorn
1 Replies

10. Programming

Locale setting

Hi, In the sample program, I am trying to print a Japanese string. The code is as follows: main() { setlocale(LC_ALL,""); printf("String is %S\n", L"JAP"); // Note "JAP" is a valid japanese string } If locale is C, the string gets printed, but if it a valid japanese locale, it... (1 Reply)
Discussion started by: Dippan
1 Replies
Login or Register to Ask a Question