Can't get Cygwin to run scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Can't get Cygwin to run scripts
# 1  
Old 12-15-2007
Can't get Cygwin to run scripts

I haven't been on a unix system in a long time and I'm trying to teach a friend unix. After looking at/testing various options cygwin seemed to be the easiest to download and install.

Everything works pretty much as I recall and I even tested a small java program on it.

I can't seem to get scripts to work. We used to set up scripts to run files and redirect output and or input.

for instance c_grape would contain java prog > prog.out
or c_ls would contain ls -l > dump

so we would chmod 777 the file and just type c_ls or c_grape and it would run.

when I try this I get an error saying command not found. I tried renaming the file with a .exe on the end of it and it ran but didn't execute the commands in the shell, as far as I can tell.

Any suggestions or comments would be greatly appreciated.
# 2  
Old 12-15-2007
Quote:
Originally Posted by mmtemp
so we would chmod 777 the file and just type c_ls or c_grape and it would run.

when I try this I get an error saying command not found
Have you given the absolute path to the script? It may be the directory the script is in is not on the PATH.

What command is it saying is not found?
# 3  
Old 12-15-2007
re: path

yeah. that was it. thanksSmilie

I don't remember having to do that and I don't know of any other systems that work that way either

when I'm in dir1 and I type java prog it works.
when I'm in dir1 and I type c_java which contains java prog it doesn't work and I get the bash: c_java: command not found.
when I'm in dir1 and I type ~/dir1/c_java it works fine but you shouldn't have to do that.
# 4  
Old 12-15-2007
Quote:
Originally Posted by mmtemp
I don't remember having to do that and I don't know of any other systems that work that way either
Really?

It's bad practice to have "." on the current path, so just typing a program name of a program in the current directory shouldn't work by default.

Alas, operating systems like CP/M hence MS-DOS hence Windows think it's okay, and don't even bother to consult PATH if it's in the current directory.
# 5  
Old 12-15-2007
Rule #1: Never have "." in your PATH.

Rule #2: Never use 777 permissions.

Rule #3: If you break rule #1 and/or rule #2, don't be surprised when it all goes pear-shaped! UNIX is allegedly famous for not having viruses, but the above two things can completely remove any need for them to knacker a system.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Scripts can be run manually but couldn't run with cronjobs

I am from MQ/MB technology. My requirement is to display the queue manger and broker status on daily basis. If I manually run the script, it works fine and displays output. But when I have scheduled the same using cronjobs it shows only the queue manger status and not the broker status. Can... (3 Replies)
Discussion started by: Anusha M
3 Replies

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

3. Shell Programming and Scripting

cygwin executable shell scripts

Hello, Cygwin will execute a shell script without turning on executable status on the file. I want to force cygwin to be more like linux and not execute scripts directly on the command line unless changing mode to have executable status. Is this possible? Thanks Larry (2 Replies)
Discussion started by: larrye0123
2 Replies

4. Shell Programming and Scripting

How to run Cygwin bash from windows scheduled task?

Hmmm.... I love these forums because I always get great prompt responses and I want to ask a question about running bash on windows. Is that allowed? Now I know I can install cygwin cron and run bash that way. Can I run bash from windows schedule task? How? thanks siegfried (1 Reply)
Discussion started by: siegfried
1 Replies

5. Shell Programming and Scripting

> in cygwin scripts

I'm using cygwin under WinXP. When I write things like ls > list.txt in shell, it works OK. But when I place it to file like this: It says that "list.txt" doesn't exists. I tried touch, but the answer is the same. (2 Replies)
Discussion started by: TeenageWerewolf
2 Replies

6. Shell Programming and Scripting

Run cygwin in .bat file

Hello everyone, I've written quite a few AWK scripts to run in cygwin and now, I would like to run them one after the other in a .bat file. The problem is, I tried modifying the .bat file used to run cygwin in the first place, but whenever I change something, it doesn't work. The PATH is set up... (3 Replies)
Discussion started by: Teroc
3 Replies

7. UNIX for Dummies Questions & Answers

tip: Simple script won't run in cygwin - vim editor involved

I ran into this issue and thanks to various postings in various forums, was able to figure out the solution but didn't see one posting that laid the whole issue out cleanly. So thought the following might help others ... ------------------------------------------------------------------------... (2 Replies)
Discussion started by: oxysep
2 Replies

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

9. Shell Programming and Scripting

how to run cgi -script on Cygwin ?

All, I would like to run a cgi script in cygwin which i have installed in WinXP. My CYGWIN directory structure is /var/www/ drwxrwx---+ 2 user Users 0 Nov 23 16:24 cgi-bin drwxrwx---+ 3 user Users 0 Oct 22 17:21 htdocs drwxrwx---+ 3 user Users 0 Oct 22 17:22 icons and another... (1 Reply)
Discussion started by: jambesh
1 Replies

10. Linux

Run Webmin on Cygwin

Hello, I was wondering how i would download Webmin and install it on Cygwin. Can you install basically any linux program on cygwin and have it run or is it differet? Thanks for your help. (6 Replies)
Discussion started by: xcaliber
6 Replies
Login or Register to Ask a Question