Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to run a linux script on my Windows machine using cygwin.

I have already read and tried the solutions from there's no sudo command in cygwin, without any success.

I have a script that uses sudo in the regular linux environment. but when I run the scirpt on cygwin, it throws this error message:

project_common.sh: line 604: sudo: command not found

I know cygwin does not have sudo, and the referenced question mentioned earlier said to use:

>#!/usr/bin/bash
>"$@"

I tried executing that command before running the script. and also embedding the command into the script. Neither one help. So not sure what am I missing.

share|improve this question

1 Answer 1

Remove any sudo's in the file and run the script as Administrator.

That being said, the Linux idea of root and Windows idea of Administrator do not correspond exactly. You may still have permission issues that need to be rectified manually or by modifying the script further, especially on Windows Vista/7.

By the way, the referenced question wanted you to put

>#!/usr/bin/bash
>"$@"

in a file named sudo, give it executable permission with chmod, and then put it in some directory in your $PATH, such as /sbin. The resulting file will not do anything except execute the paramaters you give it as a command. The idea was to make a "fake" sudo that does nothing. You can also just delete the sudo's from the file.

share|improve this answer
    
Thats not really the right answer. It is almost like saying, there is no copy command in Microsoft Office, Let rewrite MS Office. –  Churk Jun 4 '12 at 14:08
1  
No, it's like saying given operating system A and B, and capability C which works one way under A and a different way under B, that your script which can be run under A and B might need to be rewritten to account for the differences in implementation of C. –  ultrasawblade Jun 4 '12 at 14:14
1  
sudo isn't in cygwin because you essentially are the superuser of the shell when you "Run [cygwin] as Administrator". In other words, your problem is not with cygwin, it's with your file permissions in Windows. –  kevlar1818 Jun 4 '12 at 14:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.