LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-26-2015, 04:28 AM   #1
newuser85
LQ Newbie
 
Registered: Aug 2015
Posts: 15

Rep: Reputation: Disabled
Help required for executing ksh script on windows using cygwin


Hi All,

I am trying to execute ksh script on windows sever using Cygwin and getting the below error message,

Unable to initialize device PRN
Unable to initialize device PRN
Unable to initialize device PRN

Need you help to know whats the issue and how to solve it.

thanks in advance.



Hi,

Sorry for not including more details, actually I have been asked to modify an existing ksh script on SUNOS/AIX environment to work on windows environment using Cygwin.

*********************************************************


scriptname=ftpNTRS.ksh
tokenname=ftpNTRS
scriptExec=$(echo "\nRunning: $0 $*")
################################################################################
usage () {
print " Usage: Retrieve file from NTRS FTP server"
print " Syntax: ftpNTRS.ksh Productline InterfaceType "
print " Supported Interface Programs: CB185 CONFR"
scriptExit "1" "$scriptname"
}
################################################################################
#Configuration
################################################################################
#Read subroutine libraries into memory
LAWDIR="E:\xxx_Script\Scripts"
. $LAWDIR\ftp_subs.ksh
. $LAWDIR\subs.ksh
#. $LAWDIR/bin/ftp_subs.ksh
#. $LAWDIR/bin/subs.ksh

#Identify server O/S. Set path variables.
#OSname=$(/usr/bin/uname -s)
OSname="CYGWIN_NT-6.1"
case "$OSname"

in
CYGWIN_NT-6.1 ) kshPath1="/usr/bin"
kshPath2="/usr/xpg4/bin"
kshPath3="/usr/ucb"
kshPath4="/opt/cups/bin" #Path for LP command - alter if not CUPS.
kshPath5="/opt/aspx/bin"
envID=$($kshPath1/basename $LAWDIR)
# companyID=$($kshPath1/basename $LAWDIR| $kshPath1/cut -b1-4)
# printerID=$($kshPath1/basename $LAWDIR| $kshPath1/cut -b2-4)
;;

AIX ) kshPath1="/usr/bin"
kshPath2="/usr/bin"
kshPath3="/usr/bin"
kshPath4="/opt/cups/bin" #Path for LP command - alter if not CUPS.
kshPath5="/opt/aspx/bin"
envID=$($kshPath1/basename $($kshPath1/dirname $LAWDIR))
# companyID=$($kshPath1/basename $($kshPath1/dirname $LAWDIR)|$kshPath1/cut -b1-4)
# printerID=$($kshPath1/basename $($kshPath1/dirname $LAWDIR)|$kshPath1/cut -b2-4)
;;

* ) echo "ERROR: Unknown O/S name."
echo " Path for KSH programs can not be defined."
;;
esac

DATE=`/usr/bin/date +C%y%m%d`
TIME=`/usr/bin/date +%H%M%S`
logDATE=`/usr/bin/date +%m%d%y%H%M%S`

#redirector STDOUT to a log file
scriptLogDIR=$LAWDIR/tmp
if [ ! -d "scriptLogDIR" ]
then
mkdir -p "$scriptLogDIR"
fi

scriptLogName=$tokenname.$logDATE
scriptLog=${scriptLogDIR}/${scriptLogName}
exec 6>&1
exec 1> $scriptLog

**********************************************************

Cygwin version details as below.


uname -r
2.2.1(0.289/5/3)

*****@HOST-014 ~
$ uname -a
CYGWIN_NT-6.1 HOST-014 2.2.1(0.289/5/3) 2015-08-20 11:42 x86_64 Cygwin

*****@HOST-014 ~
$

********************************************

Error on the logfile

Unable to initialize device PRN
Unable to initialize device PRN
Unable to initialize device PRN
Unable to initialize device PRN
Unable to initialize device PRN
Unable to initialize device PRN
Unable to initialize device PRN
Unable to initialize device PRN
Unable to initialize device PRN
Unable to initialize device PRN
Unable to initialize device PRN
Unable to initialize device PRN
Unable to initialize device PRN

***********************************************

Please advice.

Last edited by newuser85; 08-26-2015 at 07:29 AM.
 
Old 08-26-2015, 05:01 AM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,613

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
in the dark...

Blind? Without any idea of the script contents or even a description?
You must think we are not only wizards, but mind readers! ;-)

Could you, perhaps, give us a little to go on?
Have you tried other scripts, and can you post an example of one that throws this error?
What have you attempted so far, and what results obtained?
Is this CYGWIN install current?
 
Old 08-28-2015, 06:00 AM   #3
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,613

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
how many scripts are involved?

Thank you for adding the script example.

Note that this script sources other scripts, and the detail throwing errors may be in the other scripts.
Do you have CUPS running under CYGWIN? This appears to depend heavily CUPS or something that looks like it.
Is CUPS well configured and working? Do you have a PRN printer defined?

Have you checked all of the paths? Paths on a Linux system, or under CYGWIN, are likley to differ from those under AIX, SOLARIS, or HP-UX. (Having tripped over those issues on all three!)

I much prefer running native Linux and stopped using CYGWIN some while back. When I was using it I found it very powerful. Porting things from Linux to CYGWIN was easy. Porting things from AIX to Linux more challenging. You are trying to go direct from AIX land to CYGWIN, and that is likely to take some very careful and painstaking desk checking and troubleshooting skills. This is not something to expect to finish quickly.

Sounds like fun!
 
Old 01-25-2017, 02:44 PM   #4
justdaven
LQ Newbie
 
Registered: Jan 2017
Posts: 1

Rep: Reputation: Disabled
I had the same issue..

This is due to a difference in command interpreter. The print command works with Korn Shell, but Bash uses echo, instead of print. Once I changed the prints (which in Korn route to the default printer port) to echos, I stopped getting the error.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Running Cygwin bash script from Windows kint Programming 1 04-12-2012 03:14 PM
Executable cygwin script in windows sarenace Programming 2 02-12-2012 02:14 AM
problem after moving ksh script from windows to linux aamerjavaid Linux - Newbie 3 12-31-2009 04:45 PM
Hep required on how to use cygwin XDMCP on windows to display Fedora 9 GDM window bstacey Linux - Newbie 0 12-01-2008 04:57 PM
*NIX Script Executing from Windows chrisk5527 Linux - General 7 05-02-2003 05:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration