ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi guys,
My newest problem comes from somewhat left field. My financial backer asked me to write a script for another one of his students. With all you guys have taught me, I found the job easy enough; the commands are
However, these individuals are busy people and dont want to have to download cygwin, or muck around with the command line. Is there a way of compiling these so that they come out as a windows executable file? Something that they just place in the folder containing the files of interest, double click and the script runs as written? Help would be much appreciated.
Last edited by sarenace; 05-03-2012 at 05:10 AM.
Reason: oops, published the students username by mistake. Not meant to make that public
first try to download this awk and test your scripts (if they work properly with this awk).
second make cmd files which contain the script (as quoted) and able to run on windows.
and named the file 180man.cmd. It didn't work, but what is beginning to occur to me is that this solution will only work for awk scripts. If i ever want to do some work for them that involves a command line tool other than awk, I will be back to square 1. Does anyone know of a tool that compiles simple awk scripts to make standalone windows executable's? Failing that, If i could get them to download cygwin, could i make a file that when double clicked, opens an instance of cygwin, runs the script from within its folder, and then closes again?
Ok guys, I'm back, been too busy to check in on this thread the last few days and seen it hasn't moved. How about I make the question simpler; how would I make a batch file that when double clicked runs a cygwin command, assuming cygwin has already been installed? I would really like help on this issue.
and saved as 180man.sh. I then performed the command dos2unix on the file. I then copied the file into my cygwin /bin directory. From the terminal, I performed the command
chmod a+x 180man.sh
I then returned to my working directory, and typed 180man.sh, and got the following error message
Quote:
/usr/bin/180man.sh: line 3: $'\357\273\277awk': command not found
Which is absolutely mystifying. Does anyone have any idea whats going on here????
Ok, I have tried to reduce the command to 3 and finally 1 new line; I get the error message each time, meaning something in the command is being interpreted as $'\357\273\277awk'; and I have no idea why. Has anyone else seen this behaviour from cygwin? Why would it interpret the command in the shell script to read what it does above? When I open the file in notepad I still see the awk command I have written up as per normal.
Yes. The crappy text editor you used to create the script inserted a byte order mark at the start of the file. You need to remove it, or use another editor.
The Unicode code for the BOM is U+FEFF. In UTF-8 encoding, it uses three bytes, 239 187 191 (decimal), which can be also written as \357\273\277 (octal) or \xef\xbb\xbf (hex).
Easiest way to remove the BOM from winnings.sh is to run
Code:
LANG=C LC_ALL=C sed -e 's|\xef\xbb\xbf||g' -i winnings.sh
The command will remove it from anywhere in UTF-8 text, but that's intentional. Although the BOM is only "allowed" at the start of the file, Windows utilities seem to sprinkle them willy-nilly; better remove them altogether.
You can use awk to remove BOMs and convert newlines to the Unix flavour at one go:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.