Couple of Cygwin problems

Posted by Tseris on Tue 01 Sep 2009 11:30 AM — 5 posts, 20,909 views.

#0
1. I was wondering how to change my home directory when Cygwin starts up, it gets really annoying to have to punch in

cd /cygdrive/c/Documents\ and\ Settings/User/Desktop/smaug/smaugfuss

every time I go to use it. It would be nice for it to just start out in that directory, because I dont use cygwin for anything else.


2. I followed the instructions for downloading Cygwin and got all the same packages recommended on this site, but I somehow dont have grep. Using the grep command doesnt return anything, "help grep" says no topics match, and "man -k grep" says theres nothing appropriate.

Im sure these are probably simple fixes, but I just havent been able to figure out how. Any help would be greatly appreciated.
Australia Forum Administrator #1
Tseris said:

1. I was wondering how to change my home directory when Cygwin starts up, it gets really annoying to have to punch in

cd /cygdrive/c/Documents\ and\ Settings/User/Desktop/smaug/smaugfuss

every time I go to use it. It would be nice for it to just start out in that directory, because I dont use cygwin for anything else.


Make a soft link. eg.


ln -s /cygdrive/c/Documents\ and\ Settings/User/Desktop/smaug/smaugfuss smaug


Now if you do "ls -l smaug" you should see something like:


lrwxrwxrwx   1 Owner None      63 Sep  2 07:09 smaug -> /cygdrive/c/Documents and Settings/User/Desktop/smaug/smaugfuss


See the "->" after smaug? That means smaug "points to" the other directory. Having done that, in your home directory, after starting up Cygwin, you now just have to type:


cd smaug





Tseris said:

2. I followed the instructions for downloading Cygwin and got all the same packages recommended on this site, but I somehow dont have grep. Using the grep command doesnt return anything, "help grep" says no topics match, and "man -k grep" says theres nothing appropriate.

Im sure these are probably simple fixes, but I just havent been able to figure out how. Any help would be greatly appreciated.


I get that too, but that is only the manual for grep, not grep itself. For example, typing grep on its own:


$ grep
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.


When you say "Using the grep command doesnt return anything" do you mean you get an error message like:


$ grep
bash: grep: command not found




#2
Thanks on the soft link.

On the grep issue if i type grep by itself i get the same thing you displayed.

Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.

but if I try 'grep mistwalk' for example, the cursor returns to the next line but does not display any text at all. And from that point on the terminal doesnt respond to any commands I type. I have to close down cygwin and start over.
Australia Forum Administrator #3
That is because it is searching standard input for mistwalk (that is, what you are typing). That is why it seems to not respond.

You could always hit Ctrl+C to exit if you do that by mistake.

You need to specify file names, like this:


grep mistwalk *.c


That searches all the .c files for the word "mistwalk".
#4
Ahh ok. Thanks a ton.