Setting default environment variables.

In HP-UX, I would set the HISTORY variable as follows:
HISTFILE=$HOME/.sh_history
HISTSIZE=500
If it's working, I don't know how to use it...
In HP-UX, <Esc><k> brings up previously executed commands.
In Linux, the <Up Arrow> brings up previously executed commands.
I've tried both of them, and a few other keystrokes, but to no avail...
Any help would be appreciated...
While we're on the subject of variables...

Hi,
Command History (vi mode)
The fc command: a brief history lesson
Take a look at the fc (fix command) man page. This command works almost exactly like the fc
command in bash. You feed it the number of your
previous history command and its execution is repeated. This command was actually introduced as
history in the C shell, but has evolved
since. By default, fc allows you to edit your previous commands with the ed editor (which can be
changed by modifying the FCEDIT shell variable.
Clearly, the Korn shell's command line editing features are more advanced and easier to use,
however, there are three such cases where fc can be handy:
Case 1: Repeating the Last Command Explicitly
You may already be familiar with the fc operator "r" (bash/csh equivalent is "!!") which is a built-in
alias that repeats the last command issued.
Of course, if you prefer to use the !! syntax, you can use the following alias:
alias !!='fc -e -'
Case 2: Repeating the Last Command with Replacement
If you're repeating the last command with only a slight modification, fc works great also. For
example, suppose you ran this command:
mv app-09.26.00.log oldlogs
And you also want to move the file app-09.25.00.log to the oldlogs directory. In this case, you
could use fc to accomplish your goal in less keystrokes.
fc -e - 26=25
or, you could use the Korn shell shortcut like this:
r 26=25
or even using the alias specified above:
!! 26=25
Case 3: [ESC]-v and Full vi Editing
Alternatively, you can edit the entire command line with vi using the "v" command. This type of
editing can be especially helpful for editing "for"
or "while" loops that span multiple lines. This is actually another fc alias that edits the current line in
full screen vi mode. However, since the
command is executed immediately upon exiting vi, you should pay extra attention to the command
syntax, especially when editing commands as root.
Command Line Editing in vi Mode
Instead of using fc to edit your previous commands, it's usually easier to use ksh built-ins in vi
mode.
You can use vi mode by setting the option like this:
set -o vi (when in ksh already) OR ksh -o vi (when launching a ksh shell)
In this mode, you'll want to get familiar with a few commands:
Previous Command
---->
[ESC]-k
Use this key combination to access your
previous command
Next Command
---->
[ESC]-j
Use this key combination to access your
next command (if applicable)
Filename
Completion
---->
[ESC]-
Use this key combination to complete a
filename, or partial portion thereof
Filename Check
---->
[ESC]-=
Use this key combination to show which
files would complete the command at this
point
Caveats:
There is no command completion in ksh88, though there is in ksh93.
There is no tab completion in ksh88, though there is in pdksh and ksh93
To use tab-complete in pdksh, you may need to use set -o vi-tabcomplete
To use tab-complete in ksh93 you may need to use set -o viraw
Commands can be editing using the standard vi editing keys, however, the arrow keys are not
standard vi editing keys.
There is no way (that I have discovered) to use arrow keys in ksh88
Arrow keys should work fine in pdksh
Arrow keys in ksh93 may need special key-bindings to work. Some samples are available
here from www.kornshell.com.
Finally, you can also find the last command you typed that included a certain string. This can often
be faster than searching through
previous command lines one at a time. To do so, use the syntax
[ESC]-/string
where string is the text string you're searching for. You can also use the "N" and "n" to move
forward and backward in your searches, respectively.
Other ksh Interactive Features (vi mode)
Command-line Editing
In conjunction with recalling your previous commands, you can also edit these commands.
A subset of the most common editing commands are listed below.
Forward One Character
---->
[ESC]-l
Backward One Character
---->
[ESC]-h
Delete One Character
---->
[ESC]-x
Replace One Character
---->
[ESC]-r
Forward End of Word
---->
[ESC]-e
Backward Beginning of Word
---->
[ESC]-b
Delete to End of Line
---->
[ESC]-D
Insert Text (current space)
---->
[ESC]-i
Insert Text (adjacent space)
---->
[ESC]-a
Move Cursor to Beginning of Line
---->
[ESC]-^
Move Cursor to End of Line
---->
[ESC]-$
Note: The [ESC] key is not necessary if you are currently in command-mode.
Job Control
Job control under the Korn shell actually works identically to job control under the bash shell.
However, since its a very useful
interactive shell feature, I'll summarize its uses here.
Suppose for example you want to watch the system messages on a Solaris box, you might run this
command:
# tail -f /var/adm/messages
But perhaps something isn't logging correctly and you need to make some changes to
/etc/syslog.conf. You decide to send ^Z (suspend)
to your tail process like this:
^Z[1] + Stopped (SIGTSTP) tail -f /var/adm/messages
You still want the process to run however, so using the number in brackets, you send the process to
the background like this:
# bg %1
[1] tail -f /var/adm/messages&
Now, you're free to make your syslog changes, and when you're ready to return to your tail process
you've forgotten which job it was.
In this case, you would use the jobs command to see which jobs are tasked to the current shell like
this:
# jobs
[3] + Stopped (SIGTSTP) ls -al /dev | more
[2] - Stopped (SIGTSTP) find / 2>&1 > /dev/null
[1] Stopped (SIGTSTP) tail -f /var/adm/messages
Once you know what the job number is, you can return the job to the foreground using the
command:
# fg %1
tail -f /var/adm/messages
Note that if the job number is not specified the most current active job, indicated by the "+" is
the default job. So, fg with no arguments would bring job 3 to the foreground.
Alternatively, if you wanted to kill the job at this point, this could be accomplished by using
the kill command in the following manner:
# kill %1
[1] + Terminated tail -f /var/adm/messages
Thus, we can easily see how useful job control can be, especially if you have a limited number of
login shells available.
Revert back.
Thanks.
Senthilkumar
SUN - DTS

Similar Messages

  • Setting Oracle environment variable using batch (.bat) file in windows

    Hi,
    Oracle 9i db
    Windows OS
    I am in process to create the database (Considered that Oracle9i software is already installed) by running one batch file which consist of all the scripts for the database creation.
    But i also want to set the environment variables at MyComputer(right click)>properties>advance>environment, permenently by running the batch (.bat) file
    ORACLE_HOME
    ORACLE_BASE
    ORACLE_SID
    So, how can it be done ?
    With Regards

    Hi,
    *@echo off*
    set ORACLE_SID=iprsdb
    set ORACLE_BASE=C:\oracle
    set ORACLE_HOME=C:\oracle\ora92     
    call C:\install_bkp\test_env_var.bat
    echo Test Successfull.
    Above mentioned is the code written in the batch (.bat) file
    In that i have also called another .bat file which test the env. variable values which is as below:
    c:\>test_env.bat
    ===================
    Testing oracle sid
    ===================
    iprsdb
    =====================
    Testing oracle base
    ===================
    C:\oracle
    =====================
    Testing oracle home
    =====================
    C:\oracle\ora92
    Test Successfull.
    But when i checked at MyComputer(right click)>properties>advance>environment variables
    there, I saw none of the entries from the above, why so ?
    how to set env. variables permanently using the DOS commands. ?
    With Regards

  • Set DISPLAY environment variable -- in DBCA not working at AIX OS

    Hi,
    I want to create new database in AIX OS and database is oracle 10g:-
    When i say DBCA it is giving below error, what should i do?
    $ dbca
    DISPLAY not set.
    Set DISPLAY environment variable, then re-run.
    Please help...

    Pravin wrote:
    How to set the DISPLAY environment variable in AIX?Usual format is:
    +<host>:<display-number>+
    E.g.
    export DISPLAY=192.168.0.235:1
    Where the host is the hostname or IP address of the client platform running a X-Server. If the X-Server is running locally, then this entry can be omitted.
    The display-number is the display number of the X-Server to use. A single X-Server can have multiple displays. E.g. Unix server running a X-Server can have 10 users connected via X-Terminals and will this have 10 displays.
    Judging from X-Windows questions asked on OTN, it seems to be a tad complex to grasp for some - especially those from a MS Windows background as X-Windows is very different and also reverses the client-server concept, requiring the X-Server component to be running on the client platform (where the server platform runs the program that is the X-client).
    So it is a lot easier to rather use something like VNC instead - supported on most Unix platforms, Linux, Windows and Apple's OS/X.
    Simply run the VNC server on the server platform to create a virtual container for running the X-server display. Connect from a client using a VNC client.
    As it uses the RFB (Remote Frame Buffer) protocol, it is a lot faster than running the slower and larger X11 protocol required for X-Windows connectivity over TCP/IP.

  • Why do we actuallya need the setting of environment variables?

    Hello guys,
    I read that, in order to connect to the database via SQL*Plus, we need to have the environment variables set. So, SQL*Plus is a command tool, which doesnt know over which path to connect to db, if the environment variables are not set?
    How about the needs of setting environment variables at point of view of MS-DOS? I know that over MS-DOS we can check if the environment variables are already set or not. Or we can actively set the environment variables.
    When should we actually set the environment variables? Before we run the GUI or after? I read, that if we set it before we run the GUI, then the setting will be taken over when it comes to that step by running GUI. I am curious, since this would be interesting to know, if we use other version than XE.
    Thanks..

    Oracle's flexibility ... many different versions working the same on many different versions of many different operating systems ... means that a single consistent installation and configuration methodology must work everywhere so as not to have the limitations of other competing products that work on only a single operating system or require that one learn a different syntax and methods for different versions.
    Be grateful Oracle is as it is. Your competence in one version and operating system translates into competence in others.

  • Restoring default environment variables on 10.5

    I would like to restore my default environment variables on 10.5 without doing a clean install and wiping my disk.
    Can I do this? If so, how?

    which environment variables have you changed and how? normally they are reset on logout unless you modified some system files. have you?

  • How to set ORACLE_HOME environment variables in win 2003

    Can anyone tell me how to set ORACLE_HOME environment variables in Win2003
    Please tell me the significance of that also.It will be really helpful if u can help me out from Path variable seting of JAVA SDK also... Thanks in advance...

    hi
    use this code IN FORMS60 variable in Regedit
    \\server\DATA\store\Forms;
    Rizwan

  • Setting the environment variable

    I just installed the rpm for the 1.4 SDK on my RedHat 7.1 box. Does anyone know how I can set the environment variable so it will recognize Java from the command line? Thanks in advance.

    You need to set a couple of environment variables in your "profile" script. Which one, exactly, depends on the shell you use. It's probably .profile on your home directory.
    Try
    JAVA_HOME=/usr/java1.4 (or wherever it really is)
    PATH=$PATH:$JAVA_HOME/bin
    export JAVA_HOME,PATH

  • Setting Linux environment variable

    Is there other web site which talks about how to set the environment variable of J2EE for Linux?
    I followed this web site
    http://www.dougsparling.com/comp/howto/linux_java.html
    but after all
    when I tired to compile a servlet program... it couldn't be complied. I think the case is that the compiler couldn't find servlet.jar ...
    why is that?

    You have to verify that your CLASSPATH environment variable is set in your account's profile. I use the
    bash shell therefore my variables are set in .bashrc
    for example my CLASSPATH is set to :
    CLASSPATH=.:$J2EE_HOME/lib/j2ee.jar:$J2EE_HOME/lib/locale

  • Setting new environment variable on Linux

    {noformat}I need to set new environment variable on my linux machine from inside my code. I am using csh and the command works fine from command line:
    setenv IFConfigLocation4 /home/username/myfile.xml
    But when i try the same thing from Java code it does not seem to have any effect. here is my code:
    import java.util.*;
    import java.io.*;
    public class CDE_parser_methods{
    public static String fileParse(String inFile, String parserName, String outFile, String CMConfig_locale)
    String parsed = "SUCCESSFUL";
    System.out.println("Parsing file..." + "\nParser name: " + parserName +"\nInput file name: " + inFile + "\nOutput file name: " + outFile + "\nCMConfig file is: " + CMConfig_locale);
    System.out.println("Current Java version: " + System.getProperty("java.version"));
    try
              String cmd[]={"/bin/csh", "-c", "setenv IFConfigLocation4 " + CMConfig_locale};
              Process proc = Runtime.getRuntime().exec(cmd);
              int exitVal= proc.waitFor();
              System.out.println("Value of setenv command is: " + exitVal);
              String cmd2[]={"/bin/csh", "-c", "env"};
              Process proc2 = Runtime.getRuntime().exec(cmd2);
              InputStream instr = proc2.getInputStream();
              InputStreamReader inread = new InputStreamReader(instr);
              BufferedReader buf = new BufferedReader(inread);
              String line=null;
              while((line=buf.readLine()) != null)
                   System.out.println(line);
              int exitVal2= proc2.waitFor();
              }catch(CMException cme){
                   System.out.println("Issue when trying to executing parse command, details: " + cme.getMessage());
                   System.out.println("Description of the issue is: " + cme.getDescription());
                   parsed = "FAILURE: " + cme.getDescription();
              }catch(Exception e){
                   System.out.println("Uncought exception, details: " + e.getMessage());
                   parsed = "FAILURE: " + e.getMessage();
         return parsed;
    public static void main(String[] args) {
         String results=CDE_parser_methods.fileParse("/opt/itemfield/ServiceDB/Project2/Mapping_for_Account_Number_Structure_ITS_Input_File.xls","MappingforAccountNumberStructure","/opt/itemfield/ServiceDB/Project2/test_ws_44.xml","/home/rvenishe/CMConfig.xml");
         System.out.println("Result of fileParse call is: " + results);
         }The out put of my env command does NOT contain system variable "IFConfigLocation4". Any ideas? {noformat}

    Environment variables and their values set from within a user process has their scope and lifetime limited to the process and its subprocesses. See java.lang.ProcessBuilder class and its API documentation for setting env for a subprocess that will be started by a ProcessBuilder instance. Even in the C programming we have the same limitation for the environment.
    Since they are not globally set, system command like env or Java method like System.getenv() can't see them.

  • I want to set Jdeveloper environment variables

    First,thanks for your answer.But I mean to set Jdevelop
    environment variables.If I can't set right Jdeveloper
    enironment,program can't pass the compile.Because "import
    oracle.html.*" can't be found by Jdeveloper.
    null

    Hi
    You would need to include jweb.jar file as a library in your
    project properties.
    jweb.jar comes with Oracle Application Server. Copy the jar file
    to lib directory in JDeveloper and add it as a library to the
    project.
    This would make import oracle.html.* work.
    regards
    raghu
    Micheal Chang (guest) wrote:
    : First,thanks for your answer.But I mean to set Jdevelop
    : environment variables.If I can't set right Jdeveloper
    : enironment,program can't pass the compile.Because "import
    : oracle.html.*" can't be found by Jdeveloper.
    null

  • How to set the Environment Variable

    I'm going through a tutorial on how to create an application and run from the command prompt. I have finished installing my jdk 6 Upadate 5 but i don't know how to set the Environment Variable for the javac compiler and the java interpreter to find my program.
    I have created an application called "ExampleProgram" and have saved it on drive C:. How do i set the Environment Variable so that the "javac" compiler and the "java" interpreter can find it

    gyesa_say wrote:
    I'm using Windows XP Service Pack 2.A very bad choice to go with Windows. Personally I prefer Linux.
    I Google and had several information on how set it, but i tried all of them and none seem to work.I typed "how to set environmental variable in winxp" in Google and the very first link provided all the information I needed (you need). These things will make much more sense if you go through it yourself rather than having someone else spoon-fed you the answer.

  • Setting widows environment variable like "path "

    I want to set a new value for windows environment variable path. Is there any way to set change the varibale.

    You could also use ORA_FFI package to call Windows API function SetEnvironmentVariable. There is an example below.
    See also:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/setenvironmentvariable.asp
    kernel_lhandle Ora_Ffi.Libhandletype;
    GetEnvironmentVariable_fhandle Ora_Ffi.Funchandletype;
    SetEnvironmentVariable_fhandle Ora_Ffi.Funchandletype;
    FUNCTION ff_GetEnvironmentVariable(
    fhandle Ora_Ffi.funchandletype,
    lpName varchar2,     -- address of environment variable name
    lpBuffer varchar2,     -- address of buffer for variable value
    nSize      pls_integer -- size of buffer, in characters
    ) RETURN pls_integer;
    PRAGMA interface( C, ff_GetEnvironmentVariable, 11265 );
    FUNCTION ff_SetEnvironmentVariable(
    fhandle Ora_Ffi.funchandletype,
    lpName varchar2,     -- address of environment variable name
    lpValue varchar2     -- address of variable value
    ) RETURN pls_integer;
    PRAGMA interface( C, ff_SetEnvironmentVariable, 11265 );
    function SetEnvironmentVariable(lpName varchar2, lpValue varchar2) return pls_integer IS
    BEGIN
    return ff_SetEnvironmentVariable( SetEnvironmentVariable_fhandle, lpName, lpValue );
    END;
    function GetEnvironmentVariable(
    lpName varchar2
    ) return varchar2 as
    lpBuffer char(2000);     -- address of buffer for variable value
    nSize      pls_integer; -- size of buffer, in characters
    res pls_integer;
    begin
    lpBuffer:='*';
    nSize:=2000-1;
    res:=ff_GetEnvironmentVariable(
    GetEnvironmentVariable_fhandle,
    lpName,
    lpBuffer,
    nSize );
    if res>0 then
    return substr( lpBuffer, 1, res );
    else
    return null;
    end if;
    end;
    -- Initialization
    /* Load the library */
    kernel_lhandle:=Ora_Ffi.Load_library
    ( '', 'kernel32.dll' );
    /* GetEnvironmentVariable */
    GetEnvironmentVariable_fhandle:=Ora_Ffi.Register_Function
    ( kernel_lhandle, 'GetEnvironmentVariableA', Ora_Ffi.C_Std );
    Ora_Ffi.Register_Parameter
    ( GetEnvironmentVariable_fhandle, Ora_Ffi.C_CHAR_PTR );
    Ora_Ffi.Register_Parameter
    ( GetEnvironmentVariable_fhandle, Ora_Ffi.C_CHAR_PTR );
    Ora_Ffi.Register_Parameter
    ( GetEnvironmentVariable_fhandle, Ora_Ffi.C_INT );
    Ora_Ffi.Register_Return
    ( GetEnvironmentVariable_fhandle, Ora_Ffi.C_INT );
    /* SetEnvironmentVariable */
    SetEnvironmentVariable_fhandle:=Ora_Ffi.Register_Function
    ( kernel_lhandle, 'SetEnvironmentVariableA', Ora_Ffi.C_Std );
    Ora_Ffi.Register_Parameter
    ( SetEnvironmentVariable_fhandle, Ora_Ffi.C_CHAR_PTR );
    Ora_Ffi.Register_Parameter
    ( SetEnvironmentVariable_fhandle, Ora_Ffi.C_CHAR_PTR );
    Ora_Ffi.Register_Return
    ( SetEnvironmentVariable_fhandle, Ora_Ffi.C_INT );
    To change the variable PATH you could use something like the following code:
    s:=dll_path||';'||WIN32.GetEnvironmentVariable( 'PATH' );
    res:=WIN32.SetEnvironmentVariable( 'PATH', s );

  • How do you set NLS_LANG environment variable in report builder

    How do you set up the reports builder environment to display foreign fonts.
    So far what I read makes me think that in report builder I have to set the NLS_LANG environment variable .
    If anyone has done this is that true and if so how.
    Also the languages I want to use are the following.
    Armenian
    Cambodian
    Chinese
    Russian
    Tagalog
    Vietnamese
    How do I find the NLS_LANG environment variables for these.
    Where I am at now+
    I have to set the DEVELOPER NLS LANG. I see the NLS LANG in the registry and I guess I have to add the DEVELOPER NLS LANG.
    Now I am searching for syntax. If anyone knows the syntax for those languages please let me know and how do I set more than 1 at a time.
    Howard
    Edited by: csphard on Apr 14, 2010 5:17 PM
    Edited by: csphard on Apr 14, 2010 5:22 PM
    Edited by: csphard on Apr 15, 2010 9:02 AM

    Hello Howard,
    Check out the following link here you can find your desired NLS parameters.
    http://www.oracle.com/technology/tech/globalization/htdocs/nls_lang%20faq.htm
    And about the NLS_LANG for developer why you want to create for developer. Its is already there in REGISTRY. Just seaching in developer registry you can find there.
    how do I set more than 1 at a time.
    You can set only one NLS_LANG parameter at a time.
    -Ammad
    Edited by: Ammad Ahmed on Apr 15, 2010 8:52 PM

  • Best practice for setting an environment variable used during NW AS startup

    We have installed some code which is running in both the ABAP and JAVA environment, and some functionality of this code is determined by the setting of operating system environment variables. We have therefore changed the .sapenv_<host>.csh and .sapenv_<host>.sh scripts found in the <sid>adm user home directory. This works, but we are wondering what happens when SAP is upgraded, and if these custom shell script changes to the .sh and .csh scripts will be overwritten during such an upgrade. Is there a better way to set environment variables so they can be used by the SAP server software when it has been started from <sid>adm user ?

    Hi,
    Thankyou. I was concerned that if I did that there might be a case where the .profile is not used, e.g. when a non-interactive process is started I was not sure if .profile is used.
    What do you mean with non-interactive?
    If you login to your machine as sidadm the profile is invoked using one of the files you meant. So when you start your Engine the Environment is property set. If another process is spawned or forked from a running process it inherits / uses the same Environment.
    Also, on one of my servers I have a .profile a .login and also a .cshrc file. Do I need to update all of these ?
    the .profile is used by bash and ksh
    The .cshrc is used by csh and it is included via source on every Shell Startup if not invoked with the -f Flag
    the .login is also used by csh and it is included via source from the .cshrc
    So if you want to support all shells you should update the .profile (bash and ksh) and one of .cshrc or .login for csh or tcsh
    In my /etc/passwd the <sid>adm user is configured with /bin/csh shell, so I think this means my .cshrc will be used and not the .profile ? Is this correct ?
    Yes correct, as described above!
    Hope this helps
    Cheers

  • Setting JAVA_HOME environment variable?

    Sorry for such a trivial question, but in Windows 2000 Server with Microsoft Visual J++ 6 and the JRK 1.1.8, can somebody tell me what the environment variables should be so that I can use this jdk? If not can you tell me what your environment variable JAVA_HOME points to?
    And one last question if it's not too much to ask. Can you tell me the NNTP server address for SUN so that I can go to the newsgroups in my News reader rather than over the web?
    Thanks.
    George Hester

    Thanks. I have a problem though. I installed the jdk 1.1.8 because I heard that was the last one supported using Visual J++. Hence I have a C:\jdk1.1.8. This folder has no JRE subfolder so I am stuck at what you said the Classpath should contain as the path\folder you say it should be does not exist.
    I have a folder C:\Program Files\JavaSoft\JRE\1.3.1 which has the lib folder containing rt.jar.
    So as you can see I'm sort of in a quandry.
    If I make JAVA_HOME as you say then it does not contain the JRE. If I make JAVA_HOME C:\Program Files\JavaSoft so that your suggestion for Classpath is correct that folder does not contain the jrk and it seems that I will not be using it.
    Any suggestions how to set this up so that it's right?
    George Hester

Maybe you are looking for

  • Reinstalling OS X on Macbook pro HD

    I' m having some problems fixing my MBP, i'm getting into recovery HD too try to erase the whole HD and reinstal OS X, the disk utility says that it's no possible to unmount the disk, since the current OS X is not booting, i backed up all my importan

  • In the middle of an update / sync the process stalled - the phone has a black screen

    my phone has been rendered useless - because during an update / sync it stalled.  HELP

  • Connecting to a Linksys WRT110

    I just purchased a Mac Book Pro running Mac OS X 10.6 and am trying to connect it to my wireless network. I have a Linksys WRT110 router with version 1.0.03 firmware running WPA2 Personal TKIP or AES encryption. When trying to connect from my Mac, I

  • Configuring automatic payments

    Hi Friends, I have a problem with Automatic Payments (T-Code: F110). In configuring the Automatic Payment Program I cannot add more than one House Bank Account with the same currency, bankID and payment method. The company is opening one bank account

  • Package Cannot Be Nested 1037 & Syntax Error 1084

    Trying to learn how to crerate a Box2D game in WIndows 8 Flash Pro CC.   Opened new document in ActionScript 3.0 Class or ".as" as a Flash Pro application.  Very very new to all developer languages and processes.  Please help. package {     import fl