user1210233
user1210233

Reputation: 2930

How to open .bashrc in Cygwin

When I try to compile my Android NDK program, it shows the following error:

Program "${SA}\android-ndk-r8\ndk-build.cmd" not found in PATH  

(the value of the environment variable "SA" is C:)

I am using Cygwin on Windows 7. How do I open my .bashrc file? I read that I need to add the following lines to my .bashrc to fix the problem:

NDK_HOME=/opt/android-ndk-r8


export NDK_HOME

But I am not sure how to open .bashrc and edit the file as I have never done this before.

Upvotes: 0

Views: 6423

Answers (2)

Keith Thompson
Keith Thompson

Reputation: 263337

There are a number of text editors available under Cygwin, either installed by default or installable by using setup.exe.

vi/vim is probably the most common. It has a bit of a learning curve. Run vimtutor from your command line for a tutorial.

If you're very ambitious, you can try emacs. Run emacs from the command prompt, then Control-H t to run the built-in tutorial.

nano is a simpler and more user-friendly editor. It shows the most common commands at the bottom of the screen, including a help command. It may be the best one to start with.

You can use Windows editors like Notepad or Wordpad, but they're likely to add Windows-style end-of-line markers to any files you edit. You can use the dos2unix command (man dos2unix for more information) to fix that up, but IMHO that's more trouble than it's worth unless you really like Windows editors more than Unix-style editors.

The echo command in Henry's answer is a quick-and-dirty way to add a single line to a file. If you want to do anything more complex (say, deleting or changing lines, or adding lines other than at the very end), you'll need a real editor. To edit your .bashrc:

nano ~/.bashrc

(or use another editor of your choice).

Upvotes: 1

Henry
Henry

Reputation: 43738

You can do

echo "NDK_HOME=/opt/android-ndk-r8 export NDK_HOME" >> ~/.bashrc

be sure to restart your cygwin window afterwards

Upvotes: 0

Related Questions