Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6070725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:57:57+00:00 2026-05-23T09:57:57+00:00

In linux I would go: setenv -p MYVAR somevalue But this doesn’t seem to

  • 0

In linux I would go:

setenv -p MYVAR "somevalue"

But this doesn’t seem to work in cygwin.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:57:57+00:00Added an answer on May 23, 2026 at 9:57 am

    By default Cygwin is running the Bourne shell or Bash, so the command to set a variable is different. This is the code you need:

    export MYVAR="somevalue"
    

    The export part lets the shell know that it is an environment variable instead of a local variable.

    If you type ls -a in your home directory, you should see some or all of the following files:

    .bashrc
    .bash_profile
    .profile
    

    .bash_profile is executed for login shells, and .bashrc is executed for interactive non-login shells. To most simply ensure that your environment variable is always set, open up .bash_profile and add the text:

    export MYVAR="somevalue"
    

    Your shell with then execute .bash_profile every time it starts up, and it will run this command. You will then have the MYVAR variable accessible all of the time. If you didn’t export the variable, it would only be accessible within your .bash_profile file.

    You can check that this variable is defined by printing its value to your shell:

    echo $MYVAR
    

    You can delete (unset) the variable with:

    unset $MYVAR
    

    Brief words on shell config files

    As an aside, regarding .bashrc vs .bash_profile vs. .profile, see these answers:

    • difference between .bash_profile and .bashrc
    • difference between .profile and .bash_profile

    For simplicity of configuration, I recommend sourcing your .bashrc file from .bash_profile. Add this to .bash_profile:

    if [ -f ${HOME}/.bashrc ]; then
       source ${HOME}/.bashrc
    fi
    

    This will load .bashrc from .bash_profile.

    If you do this, you can instead put the following line in .bashrc, if you wish:

    export MYVAR="somevalue"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Linux I would like to run a program but only for a limited
I thought the Linux kernel would have a massive amount of SLOC but it
I am considering beginning work on a library for Linux that would provide a
Which version of Linux would be my best choice if I want to use
What Linux commands would you use successively, for a bunch of files, to count
I would like to be able to spawn a linux process that would only
I am writing a video player on Linux and I would like to separate
I'm just wondering where in the source files of a linux kernel I would
I would like to access micro-state accounting timers programmatically on Linux. I guess the
I would like to develop Adobe Flex applications using Linux and a free environment.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.