The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
unzip via bash startup script problems easysnowboards Shell Programming and Scripting 0 05-25-2008 11:25 PM
How to use cygwin to run bash script Jenny.palmy UNIX for Dummies Questions & Answers 6 04-28-2008 09:00 AM
How to use route command on SuSE & Cygwin siegfried UNIX for Dummies Questions & Answers 3 04-12-2006 11:51 PM
Sed command in cygwin gauri_agr UNIX for Dummies Questions & Answers 2 07-27-2005 12:03 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-02-2007
Registered User
 

Join Date: Dec 2007
Posts: 30
cygwin bash startup command weirdness (part 1)

I am running (I believe) the latest stable version of cygwin
CYGWIN_NT-5.1 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygwin
on a win xp sp2 laptop.

Suppose, to make things simple for now (but I may do a part 2 posting...), that I am in a dos shell, and I want to create a bash shell and have it execute a few commands before closing and returning to the dos prompt.

I have experimentally found that this (dos) command line does the trick:
c:\cygwin\bin\bash.exe --login -c "pwd && ls -a"
It outputs
/home/BKernigan
. .. .bash_history .bash_profile .bashrc .inputrc
as expected, and then closes and returns to dos. Note that the working directory is my home directory, /home/BKernigan, and that its contents (all bash related config files) are correctly listed.

This (dos) command line
c:\cygwin\bin\bash.exe -i -c "pwd && ls -a -l"
(same as above except that -i replaces --login) partially works; it outputs
/cygdrive/d/unix/nextVersion/script
bash: ls: command not found
Here, it thinks that the working directory is the directory where I created the dos shell (d:\unix\nextVersion\script), as opposed to my cygwin home, so that is one difference from the --login version. And then, for some bizarre reason, the ls command is not found! Hmm, how can it find the pwd command but not ls? Note that the ls command really is in my cygwin installation (this is known both because the ls command in the first example worked, and I can also assure you that ls.exe is found in C:\cygwin\bin).

Does anyone have any idea what is going on here???

The web research that I did does not seem to answer this question. (The best single reference being the generic bash reference Bash Reference Manual: Invoking Bash, but I found it to be quite complex.)

Forgive me in advance if this is such an obvious error on my part.

Also, if this is not the best forum--or even the best website--for this question, by all means suggest to me where I should go and I will repost it there.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-19-2008
Registered User
 

Join Date: May 2008
Posts: 1
Ensure Path Settings

Ensure that you have set your PATH variable(in MyComputer) to point to %CYGWIN_HOME%/bin

When you are planning to run the shell script, ensure, you have sh.exe present in your %CYGWIN_HOME%/bin. you can get this file from http://russell.vcharite.univ-mrs.fr/...ts4-cygwin.zip

HTH,

SwapSawe
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:06 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0