Help with bash scripting in cygwin


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with bash scripting in cygwin
# 1  
Old 12-06-2013
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

Code:
#! /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 10
do
echo $i
for j in 1 #2 3 4 5 #6 7 8 9 10
do
echo $j
firefox -new-tab $URL
done
done

From what I understand, I think bash cannot read the file in /cygdrive/d/Playback.html as it doesnot understand the /cygdrive partition. I tried the windows notation as well, which didn't work. Could someone help me in doing this.

Thanks.

---------- Post updated at 02:55 PM ---------- Previous update was at 02:42 PM ----------

Just realized my mistake. Stupid. I was using $ in the assignment statement.

Code:
#! /bin/sh
alias firefox='/cygdrive/c/Program\ Files/Mozilla\ Firefox/firefox.exe'
URL="D:\Playback.html"
firefox &
sleep 1
for i in 1 2 3 4 5 #6 7 8 9 10
do
echo $i
for j in 1 #2 3 4 5 #6 7 8 9 10
do
echo $j
firefox -new-tab $URL
done
done

# 2  
Old 12-06-2013
If you are not sure there is always a back door...
Poet and I didn't know it...

This launches Explorer from a cygwin terminal:-
Code:
AMIGA:~> cd /cygdrive/c/windows
AMIGA:/cygdrive/c/windows> cmd.exe
Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

C:\windows>start explorer.exe
start explorer.exe

C:\windows>exit
exit
AMIGA:/cygdrive/c/windows>_

A simple shell script to do the same:-
(Don't forget to remove carriage returns, dos2unix...)
Code:
#!/bin/sh
# runexp.sh
cd /cygdrive/c/windows
cmd.exe /C "start explorer.exe"
exit


Last edited by wisecracker; 12-06-2013 at 11:03 AM.. Reason: Added the simple script...
This User Gave Thanks to wisecracker For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Using BATCH to call a BASH script on CygWin

I am trying to use a batch file to automatically execute a bash script with no luck this far. The batch script looks like this: C:\Cygwin64\bin\bash test.sh I have also tried this: C:\Cygwin64\bin\bash "C:\Cygwin64\bin\test.sh" Needless to say that the windows box has Cygwin... (7 Replies)
Discussion started by: Xterra
7 Replies

2. 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

3. 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

4. Windows & DOS: Issues & Discussions

run cygwin bash script from notepad++

I'm using Notepad++ to edit my BASH scripts and using CYGWIN to run them from Windows7. In Notepad++ there is a 'Run' capability. How do I get this to run my scripts directly without having to enter the script name from the Cygwin command line? (3 Replies)
Discussion started by: millsy5
3 Replies

5. Shell Programming and Scripting

Strange suppression of output with bash and cygwin

Hi, although I am not expert in bash, so please forgive me if this is silly, I think that this is strange: I have this command: find . -type f -print0 |xargs -0 grep -i -e 'some rexp' and it works fine. But when I create a bash script (on cygwin) to run this command, there is no output !!!... (3 Replies)
Discussion started by: Niki999
3 Replies

6. 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

7. Shell Programming and Scripting

BASH: Script jams Cygwin to 100% CPU -

I'd like to streamline the code more than a bit to get it to run faster. There's a thread about this and related issues of mine on the Cygwin mailing-list, but I want to eliminate any chances it might just be inefficient/inelegant/crappy code. A previous run of the same script on both Cygwin and... (6 Replies)
Discussion started by: SilversleevesX
6 Replies

8. 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

9. UNIX for Dummies Questions & Answers

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... (1 Reply)
Discussion started by: fabulous2
1 Replies

10. 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
Login or Register to Ask a Question