Sponsored Content
Top Forums UNIX for Dummies Questions & Answers cygwin bash startup command weirdness (part 1) Post 302148480 by fabulous2 on Sunday 2nd of December 2007 12:58:11 PM
Old 12-02-2007
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.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to use cygwin to run bash script

Hi, all, I try to run a quite simple bash script mytest.sh in cygwin, it's content is: #!/bin/bash echo "It is my first bash shell" there are three lines in the script. The second line is blank line. When I run it use command: bash c:/mytest.sh, ... (6 Replies)
Discussion started by: Jenny.palmy
6 Replies

2. Shell Programming and Scripting

unzip via bash startup script problems

i have two lines in my rc.local file that are wget -O/<path>/<file>.zip url://domain.com unzip -o /<path>/<file>.zip the wget works fine, but the unzip won't work. when i copy/pase the unzip line to the prompt it works fine. i thought that maybe the unzip was running before the wget... (0 Replies)
Discussion started by: easysnowboards
0 Replies

3. UNIX for Dummies Questions & Answers

Cygwin bash script and read command

Hello everyone, I am struggling a bit with a batch script that I need to run in cygwin. I work in winXP and I had to write some awk scripts to do some file manipulation, and now I would like to automate the process by just running a batch file so that my colleagues can use it easily. Now, the... (2 Replies)
Discussion started by: Teroc
2 Replies

4. Shell Programming and Scripting

bash command in makefile (cygwin)

Hello, In my make file (make 3.81), I use a combination of shell commands to automatically create the name of my build directory. OS := $(shell uname -s) ARCH := $(shell uname -m) KERN := $(shell uname -r | cut -d. -f 1,2) BDIR := $(OS)_$(KERN).$(ARCH)When I boot into different OSs, I... (7 Replies)
Discussion started by: LMHmedchem
7 Replies

5. Shell Programming and Scripting

redirect time command output to file (cygwin bash)

I have set up a bash script to run a long list of things that I need to time. I would like to redirect the output of time to a file. I have set it up like, echo "Runtimes for servlet 4, 100K structures" > test_times.txt echo "" >> test_times.txt echo "runs where N=10" >> test_times.txt echo... (7 Replies)
Discussion started by: LMHmedchem
7 Replies

6. Shell Programming and Scripting

Need help with simple startup bash script in CentOS

Hi guys, I am very new to linux, so please bear with me. https://www.unix.com/./images/smilies/smile.png I need a simple script (bash / .sh) to start 2 programs at server startup. Both programs should run in a detached screen of their own. So basically: 1) start a detached screen with... (2 Replies)
Discussion started by: lastcrafters
2 Replies

7. Shell Programming and Scripting

Help with bash scripting in cygwin

Hi, I am trying to write a bash script, to open firefox and then open a local webpage in a tab. This is a shell of what I have #! /bin/sh alias firefox='/cygdrive/c/Program\ Files/Mozilla\ Firefox/firefox.exe' $URL='/cygdrive/d/Playback.html' firefox & sleep 1 for i in 1 2 3 4 5 #6 7 8 9... (1 Reply)
Discussion started by: jamie_123
1 Replies

8. UNIX for Dummies Questions & Answers

How to downgrade cygwin to a part. version?

I'd like to compile gxemul under cygwin, Here a nice guy who ported the source code, but the prerequisites are needing the exact versions of the libraries https://github.com/fd00/yacp/tree/master/gxemul If I download the setup.exe from canonical cygwin web site, it automatically installs me the... (1 Reply)
Discussion started by: lucky7456969
1 Replies

9. UNIX for Dummies Questions & Answers

Bash on CygWin

I am using CygWin to run a bash file but I am getting weird results. #!/bin/bash mkdir CLEANDATA mv *FASTA CLEANDATA cd CLEANDATA ls echo "COMPLETE" And this is what I get $ ./Pipe.txt ./Pipe.txt: line 5: $'ls\r': command not found COMPLETE Moreover, the new folder is... (1 Reply)
Discussion started by: Xterra
1 Replies

10. Shell Programming and Scripting

Bash Script (tar + md) on Cygwin

Hi everybody, First, I'm sorry for my bad english! I have the following situation: I have a Windows 2012 R2 with Cygwin installed. The Windows Server is used as a backup Server with Dell AppAssure installed. At the moment, AppAssure saves Backup Targets to a repository on his D. The... (9 Replies)
Discussion started by: fibra3000
9 Replies
cr(1)							      General Commands Manual							     cr(1)

NAME
cr - converts text files between nix EOL and dos EOL SYNOPSIS
cr - | + <input file> <output file> DESCRIPTION
Text files, such as tle files, that come from a dos source usualy have the ^M symbol at the end of every line. Cr converts files between the dos newline format and the normal *nix newline format by stripping the ^M to convert dos to *nix, using the '-' option, or adding ^M to a *nix file to create the proper dos file when the '+' option is used. Although this extra character is not often a problem, programs like seesat5, which are data driven will encounter parsing problems when the extra character is present. It is these problems that cr is intended to repair. Options - | + One or the other of these options is required. The '-' option is used to remove ^M from all newlines found in the dos file. The '+' option is used to add ^M to every newline found in a *nix file. input file Fully delineated path to the input file. As this program is used in the dos environment as well, standard input is not used. output file Fully delineated path to the output file. As this program is used in the dos environment as well, standart output is not used. SEE ALSO
seesat5(1), seesat5(7), SEESAT5.INI(5), tle(5) BUGS
Cr is not an inteligent program. It methodicaly replaces/removes the offending character when it finds it in the correct context. Newline sequences found in contexts other than 'newline' will be replaced/removed just like those found in the proper context. Passing a binary file through cr is not advised, for this reason. Send all inqueries to Dale Scheetz <dwarf@polaris.net>. Debian Linux 2 April 96 cr(1)
All times are GMT -4. The time now is 05:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy