public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* bash question
@ 1997-09-24 15:36 Eric Vogel
  0 siblings, 0 replies; 17+ messages in thread
From: Eric Vogel @ 1997-09-24 15:36 UTC (permalink / raw)
  To: gnu-win32

I am using bash shell and the one thing that I can't seem to find is the
'more' command.  I can't believe that it is not implemented somewhere
since with the exception of 'ls' it is my most used command.

Regards,
Erich Vogel
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: bash question
  2002-05-16 22:39 ` Mark Blackburn
@ 2002-05-17  9:52   ` Bernard A Badger
  0 siblings, 0 replies; 17+ messages in thread
From: Bernard A Badger @ 2002-05-17  9:52 UTC (permalink / raw)
  To: Mark Blackburn, cygwin



> -----Original Message-----
> From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com]On Behalf
> Of Mark Blackburn
> Sent: Thursday, May 16, 2002 11:55 PM
> To: cygwin@cygwin.com
> Subject: Re: bash question
> 
> 
> You asked this in the wrong place btw, (I think its a bash specific
> questing) but here goes anyways:
> #!/bin/bash
> 
> i=0
> for x in 1 2 3; do
>   let i=i+1
>   echo "item $x"
> done
> 
> echo "Processed $i items"
> 
> cat > /tmp/file <<END
> item 1
> item 2
> item 3
> END
> 
> cat /tmp/file | { export i=0; while read item; do \
>   let i=i+1 ; \
>   echo "Read $item $i" ; \
> done }
> 
> echo "Processed $i items"
> 
> rm -f /tmp/file
> 
> output is:
> item 1
> item 2
> item 3
> Processed 3 items
> Read item 1 1
> Read item 2 2
> Read item 3 3
> Processed 3 items
> 
Sorry, wrong answer.  You're just printing out the first count again.
The second count is lost, but happens to be 3 also.  Add couple of lines
to the file to see:
$ ./tscript.sh
item 1
item 2
item 3
Processed 3 items
Read item 1 1
Read item 2 2
Read item 3 3
Read item 4 4
Read item 5 5
Processed 3 items

The following version works:
#!/bin/bash

i=0
for x in 1 2 3; do
  let i=i+1
  echo "item $x"
done

echo "Processed $i items"

i=0
cat > /tmp/file <<END
item 1
item 2
item 3
item 4
item 5
END

while read item; do
  let i=i+1 ;
  echo "Read $item $i" ;
done < /tmp/file  #NOTE this placement of redirection
####################################### now run it
$ ./tscript.sh
item 1
item 2
item 3
Processed 3 items
Read item 1 1
Read item 2 2
Read item 3 3
Read item 4 4
Read item 5 5
Processed 5 items
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: bash question
  2002-05-16 19:54 Andrew DeFaria
@ 2002-05-16 22:39 ` Mark Blackburn
  2002-05-17  9:52   ` Bernard A Badger
  0 siblings, 1 reply; 17+ messages in thread
From: Mark Blackburn @ 2002-05-16 22:39 UTC (permalink / raw)
  To: cygwin

You asked this in the wrong place btw, (I think its a bash specific
questing) but here goes anyways:
#!/bin/bash

i=0
for x in 1 2 3; do
  let i=i+1
  echo "item $x"
done

echo "Processed $i items"

cat > /tmp/file <<END
item 1
item 2
item 3
END

cat /tmp/file | { export i=0; while read item; do \
  let i=i+1 ; \
  echo "Read $item $i" ; \
done }

echo "Processed $i items"

rm -f /tmp/file

output is:
item 1
item 2
item 3
Processed 3 items
Read item 1 1
Read item 2 2
Read item 3 3
Processed 3 items


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* bash question
@ 2002-05-16 19:54 Andrew DeFaria
  2002-05-16 22:39 ` Mark Blackburn
  0 siblings, 1 reply; 17+ messages in thread
From: Andrew DeFaria @ 2002-05-16 19:54 UTC (permalink / raw)
  To: cygwin

I may have asked this before but I'd really like to understand this and 
get a fix for it. Given the following script:

#!/bin/bash

declare -i i=0

for x in 1 2 3; do
  let i=i+1
  echo "item $x"
done

echo "Processed $i items"

cat > /tmp/file <<END
item 1
item 2
item 3
END

declare -i i=0

cat /tmp/file | while read item; do
  let i=i+1
  echo "Read $item"
done

echo "Processed $i items"

rm -f /tmp/file

I get the following output:

$ test.sh
item 1
item 2
item 3
Processed 3 items
Read item 1
Read item 2
Read item 3
Processed 0 items

The quesiton is why is the integer "i" reporting 0 items processed for 
the second loop? I know that it has to do with the fact that a pipe is 
involved. However, how can I code this so that "i" survives?




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* BASH question
@ 2000-09-11  7:56 Pytel, Diane
  0 siblings, 0 replies; 17+ messages in thread
From: Pytel, Diane @ 2000-09-11  7:56 UTC (permalink / raw)
  To: 'cygwin@sourceware.cygnus.com'

Help!
I'm a first time user of cygwin stuff and trying to install it on a PC
with
Windows 95 OS.  When I try to run a small C program I keep getting the
message:
BASH.EXE: a.exe: cmd not found.  Details of installation are below

I wrote a small C program from class and got an a.exe file.  I guess I
don't understand 2 things:
1)  why I'm getting a .exe file from gcc.  This means I'm operating in
DOS.  I thought choosing UNIX would override that but I guess I'm too
dumb about dos and such.
2)  why I'm getting the error msg BASH.EXE: a.exe: cmd not found

Thank you.
Diane Pytel

To set up I did the following:
Clicked the install cygwin now and downloaded set up.
double clicked to run set up
hit next
hit install from Internet
local package dir is C:\\Windows
direct connect
download site ftp.freesoftware.com
under select, all of the ones that I think I wanted were listed so I did
nothing even though it said select (clicking on them gave a 'skip' so
this page was left alone)
It downloaded everything and gave me an installation complete.

OH yeah, somewhre in there I chose, UNIX and for me only.



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: BASH question
  1999-02-04 15:39   ` Michael Hirmke
@ 1999-02-28 23:02     ` Michael Hirmke
  0 siblings, 0 replies; 17+ messages in thread
From: Michael Hirmke @ 1999-02-28 23:02 UTC (permalink / raw)
  To: cygwin

Hi Daniel,

>Is there any way to keep BASH from creating a .bash_history file in my root
>dir?
Yes, create an env var named HOME pointing to wherever you want -
preferrably to your real home directory.

>
>Thanks
>
>Daniel

Bye.
Michael.
--
Michael Hirmke           | Telefon +49 (911) 557999
Georg-Strobel-Strasse 81 | FAX     +49 (911) 557664
90489 Nuernberg          | E-Mail  mailto:mh@mike.franken.de
                         | WWW     http://aquarius.franken.de/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* BASH question
  1999-02-04 12:05 Daniel
       [not found] ` < 199902042007.OAA20188@ionet.net >
  1999-02-04 15:41 ` Stipe Tolj
@ 1999-02-28 23:02 ` Daniel
  2 siblings, 0 replies; 17+ messages in thread
From: Daniel @ 1999-02-28 23:02 UTC (permalink / raw)
  To: cygwin

Is there any way to keep BASH from creating a .bash_history file in my root
dir?

Thanks

Daniel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: BASH question
  1999-02-04 15:41 ` Stipe Tolj
@ 1999-02-28 23:02   ` Stipe Tolj
  0 siblings, 0 replies; 17+ messages in thread
From: Stipe Tolj @ 1999-02-28 23:02 UTC (permalink / raw)
  To: dstritt; +Cc: cygwin

> Is there any way to keep BASH from creating a .bash_history file in my root
> dir?

yes, if your $HOME environment variable is set to your user's home dir it will
create the .bash_history file there and not in your root dir.

Regards,
Stipe

--
Stipe Tolj <tolj@uni-duesseldorf.de>

Cygwin Porting Project -- "We build UNIX on top of Windows"
http://www.student.uni-koeln.de/cygwin/

Department of Economical Computer Science
University of Cologne, Germany





^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: BASH question
  1999-02-04 12:05 Daniel
       [not found] ` < 199902042007.OAA20188@ionet.net >
@ 1999-02-04 15:41 ` Stipe Tolj
  1999-02-28 23:02   ` Stipe Tolj
  1999-02-28 23:02 ` Daniel
  2 siblings, 1 reply; 17+ messages in thread
From: Stipe Tolj @ 1999-02-04 15:41 UTC (permalink / raw)
  To: dstritt; +Cc: cygwin

> Is there any way to keep BASH from creating a .bash_history file in my root
> dir?

yes, if your $HOME environment variable is set to your user's home dir it will
create the .bash_history file there and not in your root dir.

Regards,
Stipe

--
Stipe Tolj <tolj@uni-duesseldorf.de>

Cygwin Porting Project -- "We build UNIX on top of Windows"
http://www.student.uni-koeln.de/cygwin/

Department of Economical Computer Science
University of Cologne, Germany




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: BASH question
       [not found] ` < 199902042007.OAA20188@ionet.net >
@ 1999-02-04 15:39   ` Michael Hirmke
  1999-02-28 23:02     ` Michael Hirmke
  0 siblings, 1 reply; 17+ messages in thread
From: Michael Hirmke @ 1999-02-04 15:39 UTC (permalink / raw)
  To: cygwin

Hi Daniel,

>Is there any way to keep BASH from creating a .bash_history file in my root
>dir?
Yes, create an env var named HOME pointing to wherever you want -
preferrably to your real home directory.

>
>Thanks
>
>Daniel

Bye.
Michael.
--
Michael Hirmke           | Telefon +49 (911) 557999
Georg-Strobel-Strasse 81 | FAX     +49 (911) 557664
90489 Nuernberg          | E-Mail  mailto:mh@mike.franken.de
                         | WWW     http://aquarius.franken.de/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* BASH question
@ 1999-02-04 12:05 Daniel
       [not found] ` < 199902042007.OAA20188@ionet.net >
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Daniel @ 1999-02-04 12:05 UTC (permalink / raw)
  To: cygwin

Is there any way to keep BASH from creating a .bash_history file in my root
dir?

Thanks

Daniel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: bash question
  1997-09-26 16:46 bash question Eric Vogel
@ 1997-09-27 20:11 ` justin.
  0 siblings, 0 replies; 17+ messages in thread
From: justin. @ 1997-09-27 20:11 UTC (permalink / raw)
  To: Eric Vogel; +Cc: gnu-win32

Eric Vogel wrote:

> I installed your gnu-win32 developement platform and I'm using the
> bash shell.  Everything seems to be included except the 'more'
> command which I use all the time.  I have looked for another command
> to replace it but I can't seem to find one.
>
> I may have sent this question a few days ago, but my mail system
> wasn't set up correctly, so the reply may have bounced back.
>
> Regards,
>
> Erich Vogel

alias more='more.com'
in bash. then try more. :)

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* bash question
@ 1997-09-26 16:46 Eric Vogel
  1997-09-27 20:11 ` justin.
  0 siblings, 1 reply; 17+ messages in thread
From: Eric Vogel @ 1997-09-26 16:46 UTC (permalink / raw)
  To: gnu-win32

I installed your gnu-win32 developement platform and I'm using the
bash shell.  Everything seems to be included except the 'more'
command which I use all the time.  I have looked for another command
to replace it but I can't seem to find one.

I may have sent this question a few days ago, but my mail system
wasn't set up correctly, so the reply may have bounced back.

Regards,

Erich Vogel
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: bash question
@ 1997-09-25  4:44 Earnie Boyd
  0 siblings, 0 replies; 17+ messages in thread
From: Earnie Boyd @ 1997-09-25  4:44 UTC (permalink / raw)
  To: gnu-win32, evogel

>Date: Wed, 24 Sep 1997 15:34:36 -0800
>From: Eric Vogel <evogel@micom.com>
>To: gnu-win32@cygnus.com
>Subject: bash question
>
>I am using bash shell and the one thing that I can't seem to find is 
the
>'more' command.  I can't believe that it is not implemented somewhere
>since with the exception of 'ls' it is my most used command.
>


Let me first point you to some important documents:

Read the README.txt and faq.txt file located at 
ftp://ftp.cygnus.com/pub/gnu-win32/latest/ .

Then take a look at the http://www.cygnus.com/ml/gnu-win32 web page.  
This is the mail list archive and you will be able to find the answers 
to many questions.

Goodluck,

-        \\||//
---o0O0--Earnie--0O0o----
-earnie_boyd@hotmail.com-
------ooo0O--O0ooo-------


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Bash Question.
  1997-07-30 17:35 Bardley09
@ 1997-07-31  9:39 ` David Means
  0 siblings, 0 replies; 17+ messages in thread
From: David Means @ 1997-07-31  9:39 UTC (permalink / raw)
  To: Bardley09; +Cc: gnu-win32

Bardley09@aol.com wrote:
> 
> This is probably elementary...but.  Bash doesn't recognize the current
> directory (i.e. pwd) and won't execute commands there unless it's
> in the path.  There must be a way to make it do that.  I confess I
> have not
> yet scoured the mail archives on this matter.
> 
> Brad
> 
> -
> For help on using this list (especially unsubscribing), send a message
> to
> "gnu-win32-request@cygnus.com" with one line of text: "help".

Wei Ku answered your question, but here's my 2 cents worth:

It works like unix.  Unless you have a "." in your path, you have to
execute files in the current dir like this:

./runthis

If the file is hidden (i.e., .login; .profile) then you do this:

./.profile
./.login


-- 

David Means
mailto:dmeans@bellsouth.net
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Bash Question.
@ 1997-07-31  0:02 Wei Ku
  0 siblings, 0 replies; 17+ messages in thread
From: Wei Ku @ 1997-07-31  0:02 UTC (permalink / raw)
  To: Bardley09, gnu-win32

1. There should not be any problem for bash to show the current working
directory. pwd always works.
2. to all the files in the current directory to be run, try to add . ( dot )
in PATH
ex: export PATH=.:/bin:$HOME/bin

Sincerely,
Wei Ku

***************************************
Department of Physics and Astronomy
The University of Tennessee
1408 Circle Drive
Knoxville, Tennessee 37996-1200
weiku@utkux.utcc.utk.edu
---------------------------------------
Solid State Division
Oak Ridge National Laboratory
P.O.Box 2008
Oak Ridge, TN 37831-6032
Phone: (423) 574-5795
Fax: (423) 574-4143
weiku@solid.ssd.ornl.gov
***************************************

-----Original Message-----
From: Bardley09@aol.com <Bardley09@aol.com>
To: gnu-win32@cygnus.com <gnu-win32@cygnus.com>
Date: Thursday, July 31, 1997 1:04 AM
Subject: Bash Question.



>
>This is probably elementary...but.  Bash doesn't recognize the current
>directory (i.e. pwd) and won't execute commands there unless it's
>in the path.  There must be a way to make it do that.  I confess I have not
>yet scoured the mail archives on this matter.
>
>Brad
>
>-
>For help on using this list (especially unsubscribing), send a message to
>"gnu-win32-request@cygnus.com" with one line of text: "help".
>
>

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Bash Question.
@ 1997-07-30 17:35 Bardley09
  1997-07-31  9:39 ` David Means
  0 siblings, 1 reply; 17+ messages in thread
From: Bardley09 @ 1997-07-30 17:35 UTC (permalink / raw)
  To: gnu-win32

This is probably elementary...but.  Bash doesn't recognize the current
directory (i.e. pwd) and won't execute commands there unless it's
in the path.  There must be a way to make it do that.  I confess I have not
yet scoured the mail archives on this matter.

Brad

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2002-05-17 14:00 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-09-24 15:36 bash question Eric Vogel
  -- strict thread matches above, loose matches on Subject: below --
2002-05-16 19:54 Andrew DeFaria
2002-05-16 22:39 ` Mark Blackburn
2002-05-17  9:52   ` Bernard A Badger
2000-09-11  7:56 BASH question Pytel, Diane
1999-02-04 12:05 Daniel
     [not found] ` < 199902042007.OAA20188@ionet.net >
1999-02-04 15:39   ` Michael Hirmke
1999-02-28 23:02     ` Michael Hirmke
1999-02-04 15:41 ` Stipe Tolj
1999-02-28 23:02   ` Stipe Tolj
1999-02-28 23:02 ` Daniel
1997-09-26 16:46 bash question Eric Vogel
1997-09-27 20:11 ` justin.
1997-09-25  4:44 Earnie Boyd
1997-07-31  0:02 Bash Question Wei Ku
1997-07-30 17:35 Bardley09
1997-07-31  9:39 ` David Means

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).