Solved

Shell Scripting on Cygwin and Windows

Posted on 2011-09-29
1
463 Views
Last Modified: 2013-11-15
A blank line in a shell script causes an error:
: not found[72]:
I have a lot of scripts running on UNIX-Boxes, which have too run on Windows-Servers too. Is there a way to adjust the Korn Shell or must I edit all scripts?
0
Comment
Question by:herggo
1 Comment
 
LVL 4

Accepted Solution

by:
rbride earned 500 total points
ID: 36813497
I suspect that you are running into the dreaded DOS/UNIX file problem.
Windows text files have different line endings to unix files and you can get problems if the file is in the wrong format for your system. I run bash / sh for cygwin and need to change format to unix to run under cygwin properly every so often.

You can convert the files using dos2unix or unix2dos which are available on cygwin.
http://linuxcommand.org/man_pages/dos2unix1.html
http://linuxcommand.org/man_pages/unix2dos1.html
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let’s list some of the technologies that enable smooth teleworking. 
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question