Unix Technical Forum

Korn Shell scripting question - suggestions requested

This is a discussion on Korn Shell scripting question - suggestions requested within the AIX Operating System forums, part of the Unix Operating Systems category; --> I have a question regarding a printer script problem I am trying to resolve. My company has a postscript ...


Go Back   Unix Technical Forum > Unix Operating Systems > AIX Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-04-2008, 06:52 PM
jmooreou@swbell.net
 
Posts: n/a
Default Korn Shell scripting question - suggestions requested

I have a question regarding a printer script problem I am trying
to resolve. My company has a postscript file that is produced from
Oracle and prints custom timesheets. For some reason, it has a default
call for A4 paper - this errors out the print job and some printers
handle it and we can override and print while other printers don't and
the output is flushed at the device.

I wrote a custom backend for AIX that includes a substitution of
'letter' for 'exec - or A4'. This fixed that error but created
another. All landscape print was directed to this and other problems
resulted. So, I wrote a test to see if the file was a postscript or
not, but this required a relative variable -

if [[ `head -1 $@ | grep -i Adobe | echo $?` = 0 ]];then
print "We have hit"
fi

The sed substitution would go on the "We have hit" line.

The problem now is that I can't get the script to recognize and pass
the relative var for the printfile to the enclosed head command. So I
tried another call with:

cat /etc/motd > /tmp/motd.out

This will produce output if I run it from the command line against a
canned printfile. But it won't produce output if generated by the
qdaemon from Oracle. So I am having trouble debugging this.

Do you know anyone who has print and Kornshell expertise that I could
talk to about this?

Any suggestions would be much appreciated.

Thanks,
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-04-2008, 06:52 PM
Mark Taylor
 
Posts: n/a
Default Re: Korn Shell scripting question - suggestions requested


>>if [[ `head -1 $@ | grep -i Adobe | echo $?` = 0 ]];then
>>print "We have hit"
>>fi


this is ugly.....and it wont work (you should use Adobe ; echo $?)

try using

if head -1 $@ | grep -i adobe >/dev/null
then
print "we have hit"
fi

--
Posted via http://dbforums.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:51 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com