The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Passing global variable to a function which is called by another function sars Shell Programming and Scripting 4 06-30-2008 12:39 PM
Output function into file ZINGARO UNIX for Dummies Questions & Answers 1 05-15-2008 08:11 PM
how to make a line BLINKING in output and also how to increase font size in output mail2sant Shell Programming and Scripting 3 04-14-2008 08:30 AM
Function within function (Recurance) chassis UNIX for Dummies Questions & Answers 2 09-19-2006 10:32 AM
How to convert the "select" function into a "poll" function rbolante High Level Programming 1 07-10-2001 11:49 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-23-2007
Skyybugg's Avatar
Skyybugg Skyybugg is offline
Registered User
  
 

Join Date: Mar 2007
Location: Tampa, FL
Posts: 26
Question Function output

I am working on a script that will recycle processes in an application identified by entry ids. I am reading a file, and using the first field in the records in file to store the entry ids. The second field is a description. I have two records in this file to test my script.
My code to do this works! The problem is when I go to put it in a function, it again works, I just do not get the output to my shell session. Why is that?
How do I force the output to also echo to the shell session? It related to how I call the function? - Thanks ~SkyyBugg
=============================
If I comment out:
#doIt ()
#{
#}
#doit
I get the output!

I'd like to keep the function.

code:
cat /home/thomasm/cycler_printer_mt.ksh
#/usr/bin/ksh!
################################################
# Author: SKyyBugg
# Date 03-22-2007
# Purpose: to cycle servers
#
################################################
#
TODAY=`date +%m%d%y`
RTIME=`date +%c`
NODE_NAME=`hostname`
DOMAIN=build
UN=cycler
PW=allonsy
CYCLER=/cerner/w_standard/build_m04/aixrs6000/cycler
FILE_PATH=/unixadmin/bin
LOG=/unixadmin/log/${DOMAIN}.cycler.${TODAY}.log
IFS=":"
#
#
set -x
############
doIt ()
{

echo "Cycling servers for printers"
echo "In Domain: " ${DOMAIN}
echo ${CYCLER}
while read no descr
do
echo "Cycling Server: " ${no} ${descr}
${CYCLER} $no ${NODE_NAME} "-l" ${UN} ${DOMAIN} ${PW}
done< ${FILE_PATH}/.${NODE_NAME}.${DOMAIN}.cyc.pri.ser.lst >>$LOG
}
########
#MAIN
#######
doIt


~~~~~~
content of input file:
cat .cerntst1.build.cyc.pri.ser.lst
54:CPM Async Script
56:CPM Script Batch
  #2 (permalink)  
Old 03-23-2007
Shell_Life's Avatar
Shell_Life Shell_Life is offline
Registered User
  
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 695
Try replacing:
done< ${FILE_PATH}/.${NODE_NAME}.${DOMAIN}.cyc.pri.ser.lst >>$LOG

by:
done< ${FILE_PATH}/.${NODE_NAME}.${DOMAIN}.cyc.pri.ser.lst | tee -a $LOG
  #3 (permalink)  
Old 03-23-2007
Skyybugg's Avatar
Skyybugg Skyybugg is offline
Registered User
  
 

Join Date: Mar 2007
Location: Tampa, FL
Posts: 26
That did it! Seen use of tee before but never used it myself. I see that -a appends.
Thanks
SkyyBugg
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:00 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0