?
Solved

Shell Scripting on Cygwin and Windows

Posted on 2011-09-29
1
Medium Priority
?
469 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
rbride earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

A safe way to clean winsxs folder from your windows server 2008 R2 editions
Ever wonder what it's like to get hit by ransomware? "Tom" gives you all the dirty details first-hand – and conveys the hard lessons his company learned in the aftermath.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

801 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