Single-session bash environment variables

I would like to run a program with a specific proxy, but I don't want any other programs to use that proxy. Would something like this work?
#!/bin/sh
http_proxy=proxy_address
program_name
exit 0
Do I need to export the http_proxy variable? It seems like the variable would be persistent instead of just being used for the one program that is being called.

mrbug wrote:
Ah.. Thanks for replying!
So then the export lines in .bashrc send the variables only to your spawned (which turns out to be every) bash processes? That must be what was confusing me...
Exactly
mrbug wrote:Just out of curiosity, how would you (if it's possible) send variables to a parent process?
I think it's not possible. Please correct me if I'm wrong!

Similar Messages

  • Using BASH environment variables in xCode build configuration

    Hi All,
    Is it possible to use BASH environment variables (exported from /etc/profile, for example) in xcode build settings?
    Specifically, I am exporting a "BOOST_HOME" variable, and would like to referencing this variable in "User Header Search Path", but the obvious $BOOST_HOME doesn't seem to work?
    Thanks,
    Andrew

    I don't know much about XCode -- but to set environment variables for GUI applications you need to edit ~/.MacOSX/environment.plist. There's a description here:
    http://wiki.lyx.org/Mac/Environment
    After editing that file I believe you have to logout and back in for the changes to take effect.
    I swear I saw a GUI app to help edit that file, but I can't find it now...

  • False Positive on Sig 4689/1 Bash Environment Variable Command Injection

    I am seeing what I believe is false positives on Sig 4689/1 outbound from our network. When I look at the traffic capture from events it does not seem to match inbound traffic events that fire on the same signature. The inbound traffic looks very much like what I think is the exploit code for the Bash injection vulnerability. 
    Any one else seeing this on their systems?
    Mike

    I'm seeing things like this. Whenever I look up the victim IPs they resolve to Amazon servers. It looks like a false positive to me also.
    event_id = 1360033965674082135
    severity = high
    device_name = xxxxxxx
    app_name = sensorApp
    receive_time = 09/28/2014  06:32:59
    event_time = 09/28/2014 10:33:29
    sensor_local_time = 09/28/2014 06:33:29
    sig_id = 4689
    subsig_id = 1
    sig_name = Bash Environment Variable Command Injection sig_details = CVE-2014-6271 sig_version = S824 attacker_ip = xxx.xxx.xxx.xxx attacker_port = 50986 attacker_locality = OUT victim_ip = 54.204.5.190 victim_port = 80 victim_os = unknown unknown (relevant) victim_locality = OUT summary_count = 0 initial_alert_id = summary_type = is_final_alert = interface = GigabitEthernet0/1 vlan = 0 virtual_sensor = vs0 context = bGVicml0eWJhYmllcy5wZW9wbGUuY29tJTdDYWlkJTNEMjA4OTQ1JTdDY2glM0RiYWJpZXMlN0NzY2glM0RuZXdzJTdDcHR5cGUlM0Rjb250ZW50JTdDY3R5cGUlM0RibG9nJTdDcGFnZSUzRDElN0NzdWJqJTNEYmFiaWVzJTJDa2FueWUtd2VzdCUyQ2tpbS1rYXJkYXNoaWFuJTJDbmV3cyU3Q2NlbGViJTNEJTdDdW5pcXVlJTNEZnVuY3Rpb24rKCkrJTdCJTBBKysrKysrKysrKysrdmFyK2ErJTNEKyU1QiU1RCUyQ2srJTNEKzAlMkNlJTNCJTBBKysrKw==$
    actions = droppedPacket+deniedFlow+tcpOneWayResetSent
    alert_details = InterfaceAttributes:  context="single_vf" physical="Unknown" backplane="GigabitEthernet0/1" ; risk_rating_num = 100(TVR=medium ARR=relevant) threat_rating = 65 reputation = protocol = tcp

  • Cisco 3560 GNU Bash Environment Variable Command Injection Vulnerability

    Does this model 3560 is affected by this vulnerability? If does are there any configuration is required to solve this Bash Code Injection Vulnerability issue? Thanks guys!

    I'm seeing things like this. Whenever I look up the victim IPs they resolve to Amazon servers. It looks like a false positive to me also.
    event_id = 1360033965674082135
    severity = high
    device_name = xxxxxxx
    app_name = sensorApp
    receive_time = 09/28/2014  06:32:59
    event_time = 09/28/2014 10:33:29
    sensor_local_time = 09/28/2014 06:33:29
    sig_id = 4689
    subsig_id = 1
    sig_name = Bash Environment Variable Command Injection sig_details = CVE-2014-6271 sig_version = S824 attacker_ip = xxx.xxx.xxx.xxx attacker_port = 50986 attacker_locality = OUT victim_ip = 54.204.5.190 victim_port = 80 victim_os = unknown unknown (relevant) victim_locality = OUT summary_count = 0 initial_alert_id = summary_type = is_final_alert = interface = GigabitEthernet0/1 vlan = 0 virtual_sensor = vs0 context = bGVicml0eWJhYmllcy5wZW9wbGUuY29tJTdDYWlkJTNEMjA4OTQ1JTdDY2glM0RiYWJpZXMlN0NzY2glM0RuZXdzJTdDcHR5cGUlM0Rjb250ZW50JTdDY3R5cGUlM0RibG9nJTdDcGFnZSUzRDElN0NzdWJqJTNEYmFiaWVzJTJDa2FueWUtd2VzdCUyQ2tpbS1rYXJkYXNoaWFuJTJDbmV3cyU3Q2NlbGViJTNEJTdDdW5pcXVlJTNEZnVuY3Rpb24rKCkrJTdCJTBBKysrKysrKysrKysrdmFyK2ErJTNEKyU1QiU1RCUyQ2srJTNEKzAlMkNlJTNCJTBBKysrKw==$
    actions = droppedPacket+deniedFlow+tcpOneWayResetSent
    alert_details = InterfaceAttributes:  context="single_vf" physical="Unknown" backplane="GigabitEthernet0/1" ; risk_rating_num = 100(TVR=medium ARR=relevant) threat_rating = 65 reputation = protocol = tcp

  • Unset environment variables not commiting, still there when bash restart

    I want to remove some environment varibles so i use the unset command
         unset variable
    However when I list the varibles using:
         env
    The variable seems to be gone but when I restart the bash it comes back again? Any ideas why? And how to resolve this?

    Every shell instance has its own environment. Changing the environment in one shell session has no effect on future sessions.
    (An exception is a sub-shell, which inherits its parent's environment. For example, if you run a script from an interactive session, the script will start with the interactive session's environment.)
    If you want every login session to have a certain environment, you set it in a .bash_profile file. See the bash man page for details.

  • PATH environment variable, Bash

    I want to set a symlink to this path:
    /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/django-admin.py
    I have tried myself & have failed the last two days. Does anyone have any suggestions on setting up a symlink to this path?
    Also should I put it in my bashrc file or my .profile (file)? thanks.

    Terminal, Unix, shell, etc... questions are best asked in the Mac OS X Technologies > Unix Forum
    <http://discussions.apple.com/forum.jspa?forumID=735>
    ln -s /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/django-admin.py /path/to/where/you/want/the/symlink/to/reside
    A symlink is a file in the file system, so once you create it, it is going to stay until you delete it. No need to put this in .bashrc or .profile
    Unless you were actually asking about a shell command alias, which is not to be confused with a Finder Alias, as a Finder Alias is more like an symlink, only different, than it is like a shell command alias.
    A shell alias would be
    alias fred='/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/django-admin.py'
    and that you would ideally put in your .bashrc, but .bashrc is not invoked during login, unless you source it from your .profile (assuming you do not also have a .bash_profile, which would get invoked instead of .profile, as bash has rules explained in "man bash" about what initialization files it reads, and which ones it preferes.
    As for the PATH environment variable, that would be exported from .profile (again keeping in mind the rules about .profile vs .bash_login vs .bash_profile).
    It is unclear whether you want a symlink to django-admin.py, a command alias, or just to put /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ in your PATH.
    Please take any follow up discussions to the Unix forum.

  • Environment Variables in a single host same user  two Oracle homes OAS

    Hello All.
    I've been googleing and looking over otn site but I cannot find solution to my question that, perhaps, is pretty easy.
    I have an OAS 10g installation in a Linux single node.
    I've made the installation the INFRA and the MT with the same user (oracle)
    If I set the ORACLE_HOME in the oracle user .bash_profile my command lines will work just for the ONE of the Oracle Home (the one pointed in the profile).
    I have two solutions:
    1. Make the .bash_profile dynamic. that is to program like a menu to ask what Environment Variables to load (infra's or MT's.)
    2. Make like .bat files to just call them and set whatever I need.
    Sounds simple, but I have no idea how to make or program any of them. I am pretty much a newbie in unix shell script programming.
    Thanks in advance any help.

    Ricard wrote:
    Hi
    This is for test purpose.
    I know oracle dont enjoy having same SID for 2 instances in same host.
    I was reading about it and seems is possible on UNIX machines. So i tried to do in a red hat linux enterprise 4.
    But with dbca, im always stoped by oratab, cause cant have same oracle_sid in oratab.
    Any idea how to do it?
    Not using dbca and making the database manually via script?
    ThanksWell, if you read this link,
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/startup.htm#CNCPT601
    And from here, this quote,
    >
    Multiple instances can run concurrently on the same computer, each accessing its own physical database. In large-scale cluster systems, Real Application Clusters enables multiple instances to mount a single database.>
    One instance can be used only by one single database on a box. There may be another instance of the same name available but Oracle won't let you open that database. You will receive,
    ORA-01102 cannot mount database in EXCLUSIVE modeCause: Some other instance has the database mounted exclusive or shared.
    Action: Shut down the other instance or mount in a compatible mode.>
    So , in any case, you are limited to one single database and one instance. As Paul mentioned, using different case, you may be able to achieve this but that still can't be called a true test as on *nix, case does matter and ORCL and orcl are going to be considered as two different databases.
    HTH
    Aman....

  • [SOLVED] bash - diff btwn 'normal' environment variables and VAR=x cmd

    I always assumed variables passed like this:
    VAR=value cmd
    are passed to the program in the same way as environment variables. However; this is not the case; who can explain this?
    $ svn commit
    svn: E205007: Commit failed (details follow):
    svn: E205007: Could not use external editor to fetch log message; consider setting the $SVN_EDITOR environment variable or using the --message (-m) or --file (-F) options
    svn: E205007: None of the environment variables SVN_EDITOR, VISUAL or EDITOR are set, and no 'editor-cmd' run-time configuration option was found
    $ VISUAL=$VISUAL svn commit
    Sending file
    Deleting file
    Adding file
    Transmitting file data ..
    Last edited by Spider.007 (2014-04-24 17:55:49)

    I'm curious too.  I could at least *speculate* on how it could go wrong the other way around: if the envoked process spawns a new process that inherits a more general environment than the parent's, the first could work and the second could fail - but these results indeed should not happen.
    Test code as evidence that the variables are passed in the same way:
    #include <stdio.h>
    int main(int argc, char **argv, char **env) {
    char **envp;
    for (envp = env; envp && *envp; envp++) printf("%s\n", *envp);
    return 0;
    Basically this is a very basic `env'.  It shows all environment variables known to the process.  No matter how they are set, they are all placed in env.
    NOTE: most programs will use getenv() rather than the extra parameter to main(), but this is meant to test what is passed where.
    Last edited by Trilby (2014-04-24 13:07:21)

  • Showing environment variables on the logon screen?

    How can I show the OS environment variables of a user on the login page of an application. Things like OS, logged in user (this is the user logged in in the OS), screen resolution, browser etc... The logged in user is the most important data I want here...

    Hi Tom,
    Please check out the following threads as they should help:-
    Re: Getting windows username from Oracle Apex
    Re: Active Directory Single SignOn Session ..
    Regards
    Keith

  • Shell script to launch terminal session with environment sourced

    Hi all
    I've installed 12.1.1 on OEL 5.
    As i've installed with a single user, I will need to switch between the app and db tier.
    I'd like to create two scripts, one that opens a terminal session and sources the app env file, and another one that opens the terminal session and sources the db env file.
    Anyone done anything like this before?
    Thanks

    Hi,
    As i've installed with a single user, I will need to switch between the app and db tier.
    I'd like to create two scripts, one that opens a terminal session and sources the app env file, and another one that opens the terminal session and sources the db env file.
    Anyone done anything like this before?Yes -- Source the application/database env file in the OS user's profile (.bash_profile or .profile), and all the environment variables should be set when you login as applmgr/oracle user.
    Thanks,
    Hussein

  • X11 environment variables on MacBook Pro

    Hi
    I have just got my new MacBook Pro and have installed Gimp to run using x11 that came on the apple installation disks however I can't seem to get the xterm to configure correctly.
    GIMP is installed under /sw/bin but the default PATH for x11 does not include this location so I added PATH=$PATH:/sw/bin:/sw/sbin to a newly created .bash_profile. But x11 did not seem to use this file although terminal worked OK.
    After doing a bit of research, I then created a .bashrc file with the PATH defined and changed the .bash_profile to source .bashrc with no other entries.
    Again this worked OK for Terminal but now when I type 'echo $Path' in an x11 xterm the PATH displays two entries for /sw/bin & /sw/sbin. i.e.
    $ echo $PATH
    /usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/sw/bin:/sw/sbin:/sw/bin:/sw/sbin
    Any ideas why? and how can I correct it?
    Macbook Pro 17   Mac OS X (10.4.9)  

    Sorry this was a bit brief; I think I was still asleep when I typed it.
    The reasons are these:
    1. Many fink programs require environment variables and other settings. When you source that init.sh file, it ensures everything is set up to work out of the box. (Among the things it does is to in turn source every relevant file in /sw/etc/profile.d -- take a look in it to see what, if anything, is in there). There is also some code to keep your path trimmed properly, so you don't get repeats pasted on.
    2. Bash is unique in that either .bashrc or .bash_profile, but not both, get sourced. In a rooted X11 environment, everything works properly, but on OS X, where X11 is "rootless," it leads to unexpected behavior like what you saw. As long as you put everything into one file and then tell the other one to source its contents, you should be ok.
    You can also run X11 stuff from Apple's terminal, provided you somewhere in a startup file have something to set the DISPLAY variable, usually to .0.
    I've put more discussion of these things here

  • How to Use Transient View Objects to Store Session-level Global Variables

    hi
    Please consider section "40.8.5 How to Use Transient View Objects to Store Session-level Global Variables"
    at http://download.oracle.com/docs/cd/E14571_01/web.1111/b31974/bcstatemgmt.htm#ADFFD19610
    Based on this documentation I created the example application
    at http://www.consideringred.com/files/oracle/2010/ProgrammaticalViewObjectAndRollbackApp-v0.01.zip
    It behaves as show in the screencast at http://screencast.com/t/qDvSQCgpvYdd
    Its Application Module has a Transient View Object instance "MyEmployeesContextVOVI", as master for the child View Object instance "EmpInCtxJobVI".
    On rollback the Transient View Object instance keeps its row and attribute values.
    Also when passivation and activation is forced (using jbo.ampool.doampooling=false ) the Transient View Object instance seems to keep its row and attribute values.
    questions:
    - (q1) Why does the expression #{bindings.MyEmployeesContextVOVIIterator.dataControl.transactionDirty} evaluate as true when a Transient View Object instance attribute value is changed (as shown in screencast at http://screencast.com/t/qDvSQCgpvYdd )?
    - (q2) What would be a robust approach to make a Transient View Object instance more self-contained, and manage itself to have only one single row (per instance) at all times (and as such removing the dependency on the Application Module prepareSession() as documented in "5. Create an empty row in the view object when a new user begins using the application module.")?
    many thanks
    Jan Vervecken

    Thanks for your reply Frank.
    q1) Does sample 90 help ? http://blogs.oracle.com/smuenchadf/examples/
    Yes, the sample from Steve Muench does help, "90. Avoiding Dirtying the ADF Model Transaction When Transient Attributes are Set [10.1.3] "
    at http://blogs.oracle.com/smuenchadf/examples/#90
    It does point out a difference in marking transactions dirty by different layers of the framework, "... When any attribute's value is changed through an ADFM binding, the ADFM-layer transaction is marked as dirty. ...".
    This can be illustrate with a small change in the example application
    at http://www.consideringred.com/files/oracle/2010/ProgrammaticalViewObjectAndRollbackApp-v0.02.zip
    It now shows the result of both these expressions on the page ...
    #{bindings.MyEmployeesContextVOVIIterator.dataControl.transactionDirty}
    #{bindings.MyEmployeesContextVOVIIterator.dataControl.dataProvider.transaction.dirty}... where one can be true and the other false respectively.
    See also the screencast at http://screencast.com/t/k8vgNqdKgD
    Similar to the sample from Steve Muench, another modification to the example application introduces MyCustomADFBCDataControl
    at http://www.consideringred.com/files/oracle/2010/ProgrammaticalViewObjectAndRollbackApp-v0.03.zip
    public class MyCustomADFBCDataControl
      extends JUApplication
      @Override
      public void setTransactionModified()
        ApplicationModule vApplicationModule = (ApplicationModule)getDataProvider();
        Transaction vTransaction = vApplicationModule.getTransaction();
        if (vTransaction.isDirty())
          super.setTransactionModified();
    }Resulting in what seems to be more consistent/expected transaction (dirty) information,
    see also the screencast at http://screencast.com/t/756yCs1L1
    Any feedback on why the ADF Model layer is so eager to mark a transaction dirty is always welcome.
    Currently, question (q2) remains.
    regards
    Jan

  • How do I clear environment variables in 10.6

    I am having some difficulty in configuring custom paths with my environment variable, environment.plist.  In setting up some of my software, I am trying to configure custom paths so that I can eventually store preferences on the server for all users to access the same tools.  I had this working up until last week, when I installed a second piece of software, that modified my environment.plist file, which now doesn't work at all.
    My original environment.plist file, which is located in ~/MacOSX, was as follows:
    <plist version="1.0">
      <dict>
        <key>NUKE_PATH</key>
        <string>/Users/jamesdavidson/Documents/Nuke_Gizmos/Nuke</string>
        <key>OFX_PLUGIN_PATH</key>
        <string>/Users/jamesdavidson/Documents/Nuke_Gizmos/OFX</string>
      </dict>
    </plist>
    Which worked just fine.  It was then changed to:
    <plist version="1.0">
      <dict>
        <key>NUKE_PATH</key>
        <string>/Users/jamesdavidson/Documents/Nuke_Gizmos/Nuke</string>
        <key>OFX_PLUGIN_PATH</key>
        <string>/Users/jamesdavidson/Documents/Nuke_Gizmos/OFX</string>
        <key>PATH</key>
        <string>/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/Applications/Deadline/Resou rces/bin</string>
      </dict>
    </plist>
    and now, the only variable that shows up is PATH.  I edited the file back to the original, without the PATH variable, restarted my machine, and yet my Variables did not change...  Is there somewhere else that I should be looking?  Some other file?   this is what I get from terminal:
    $ echo $NUKE_PATH
    $ echo $OFX_PLUGIN_PATH
    $ echo $PATH
    /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Applications/Deadline /Resources/bin
    And this even after deleting my environment.plist file.  Any help would be appreciated.
    Thanks,
    James

    I hope you made a typo in your post and meant ~/.MacOSX.  You typed ~/MacOSX, i.e., without the leading dot.
    At any rate $PATH is a predefined shell variable so I suspect you cannot define that one with this environment.plist mechanism.  The "proper" way to set up such things is with a  ~/.bash_profile, ~/.bash_login, ~/.profile, or IMO, best of all. ~/.bashrc.  These are scripts the shell looks for during launch (somewhat depending on whether it's a login shell or not -- see the bash reference manual).
    If bash is executed interactively it will also first look for /etc/profile.  And it will cause a $PATH variable to be created.  So that is probably the definition you are seeing all the time until you create an appropriate startup script of your own (e.g., ~/.bashrc) to override or modifiy the existing $PATH variable.
    Note, I may have paraphrased a lttile too much so see section 6.2 Bash Startup Files in the bash reference documentation for the complete proper description of the order these files are used.  If you have the developer tools installed look for bashref.html.  Otherwise it's online here.
    Finally, if you look at /etc/profile you will see it attempting to execute /usr/libexec/path_helper -s.  Try that in terminal and see if that isn't the $PATH definition you are currently seeing.

  • Setting environment variable CONFIGROOT

    Hi
    I want to find the msg store for a particular user account so i'm planning to use hashdir command utility and the requirement for the same is given
    below
    Requirements:
    Must be run locally on the Messaging Server. Make sure that the environment variable CONFIGROOT is set to msg_svr_base/config.
    My Ques..
    1. How i have to set CONFIGROOT and in which file ???
    Thanks in Advance

    Hi,
    CONFIGROOT is a shell environment variable. It needs to be set in the environment of the shell you are using for example for bash shell:
    export CONFIGROOT=<msg_base>/config
    Regards,
    Shane.

  • 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

Maybe you are looking for

  • X1 Carbon 2014 battery

    I have had my new X1 carbon for a couple of weeks. Up until this last weekend I haven't used it for longer than 2 hours without charging it again. This past weekend I decided I wanted to see how long the battery life really was. After about 3 hours,

  • Read only af:inputText being rendered as "span" instead of read only input

    I am using JDeveloper 11.1.1.6.0 I have noticed that when using components such as "af:inputText" and "af:inputDate" with the "readOnly" attribute set to true, the resulting render is a label as a "<span>" element as opposed to a read only <input> el

  • Photoshop CC crashes frequently, with eyedropper tool (white/black/gray point setter in curves)

    I get photoshop crashing all the time, multiple times an hour, regardless of various setting changes, here are a few crash logs. This is not my computer, but i have seen the same error on my laptop as well. It most often(almost always) happens on cli

  • Systemd access to /dev when logged in through ssh

    I have user "X" logged in through SLIM and proper permissions to /dev devices are granted. When I log in as the same user "X" through SSH, I can't access /dev devices. This prevents me from running emulators and sound applications through SSH, which

  • How can I tell which page is hogging my CPU?

    You know how sometimes when you're browsing your cooling fans will kick into overdrive, and your MacBook becomes noticeably warm, if not downright hot, and if you open the Activity Monitor and sort processes by %CPU it shows the Flash plug-in at the