[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

output not being displayed



Hi,

Consider the following ksh script(www.openbsd.org is used as an example
so that I have a non-private ip):

#!/bin/ksh
set -a

GWTS="`date +'%m/%d/%y %T'`"
GWRAW="`ping -c 1 129.128.5.191`"
GWSTAT="`echo ${GWRAW} | egrep -v '100%'`"

if [ -z "${GWSTAT}" ]; then
   echo "dead"
else
   echo "alive"
fi

GWFMT="`echo ${GWRAW} | sed -e\"s/PING 129.128.5.191 (129.128.5.191): 56
data bytes 64 bytes from 129.128.5.191://\"`"

echo "${GWTS}"
echo "=-------------------------------="
echo "${GWFMT}"
echo "=-------------------------------="
echo "${GWTS} : $GWFMT"

Pretty simple enough...if the ping fails report dead, print the date,
print the ping output minus the header, then print the date and ping
output on the same line.

/home/data % typescript
Script started, output file is typescript
/opt/home/data % gw-ping2
alive
02/01/01 15:13:52
=-------------------------------=
--- 129.128.5.191 ping statistics --- 1 packets transmitted, 1 packets
received, 0% packet loss round-trip min/avg/max/std-dev =
154.351/154.351/154.351/0.000 ms
=-------------------------------=
--- 129.128.5.191 ping statistics --- 1 packets transmitted, 1 packets
received, 0% packet loss round-trip min/avg/max/std-dev =
154.351/154.351/154.351/0.000 ms
/opt/home/data % exitScript done, output file is typescript

Notice there is no date in the final output.  If we look at the
typescript
file we see all the correct info:

/home/data % more
typescript                                                   
Script started on Thu Feb  1 15:13:46 2001
/opt/home/data % gw-ping2^M
alive
02/01/01 15:13:52
=-------------------------------=
 icmp_seq=0 ttl=240 time=154.351 ms ^M--- 129.128.5.191 ping statistics
--- 1 pa
ckets transmitted, 1 packets received, 0% packet loss round-trip
min/avg/max/std
-dev = 154.351/154.351/154.351/0.000 ms
=-------------------------------=
02/01/01 15:13:52 :  icmp_seq=0 ttl=240 time=154.351 ms ^M---
129.128.5.191 ping
 statistics --- 1 packets transmitted, 1 packets received, 0% packet
loss round-
trip min/avg/max/std-dev = 154.351/154.351/154.351/0.000 ms
/opt/home/data % exit
Script done on Thu Feb  1 15:13:54 2001

Am I missing something here?  Why can't this information be seen except
in the typescript? I've tested this on two 2.7 machines and get the same
output.


-- dmesg --
OpenBSD 2.7 (GENERIC) #25: Sat May 13 18:04:26 MDT 2000
    deraadt_(_at_)_i386_(_dot_)_openbsd_(_dot_)_org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: AMD K6-2 ("AuthenticAMD" 586-class) 401 MHz
cpu0: FPU,V86,DE,PSE,TSC,MSR,MCE,CX8,PGE,MMX
real mem  = 133804032 (130668K)
avail mem = 119488512 (116688K)
using 1658 buffers containing 6791168 bytes (6632K) of memory
mainbus0 (root)
bios0 at mainbus0: AT/286+(ac) BIOS, date 07/29/98
apm0 at bios0: Power Management spec V1.2
apm0: AC on, battery charge unknown
pci0 at mainbus0 bus 0: configuration mode 1 (no bios)
pchb0 at pci0 dev 0 function 0 "VIA VT82C597 (Apollo VP3) Host-PCI" rev
0x04
ppb0 at pci0 dev 1 function 0 "VIA VT82C598 (Apollo MVP3) PCI-AGP" rev
0x00
pci1 at ppb0 bus 1
pcib0 at pci0 dev 7 function 0 "VIA VT82C586 (Apollo VP) PCI-ISA" rev
0x41
pciide0 at pci0 dev 7 function 1 "VIA VT82C586A IDE" rev 0x06: DMA,
channel 0 configured to compatibility, channel 1 configured to
compatibility
wd0 at pciide0 channel 0 drive 0: <WDC AC24300L>
wd0: can use 32-bit, PIO mode 4, DMA mode 2, Ultra-DMA mode 2
wd0: 16-sector PIO, LBA, 4112MB, 4092 cyl, 16 head, 63 sec, 8421840
sectors
wd1 at pciide0 channel 0 drive 1: <WDC AC24300L>
wd1: can use 32-bit, PIO mode 4, DMA mode 2, Ultra-DMA mode 2
wd1: 16-sector PIO, LBA, 4112MB, 4092 cyl, 16 head, 63 sec, 8421840
sectors
pciide0: channel 0 interrupting at irq 14
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2 (using DMA data
transfers)
wd1(pciide0:0:1): using PIO mode 4, Ultra-DMA mode 2 (using DMA data
transfers)
atapiscsi0 at pciide0 channel 1
scsibus0 at atapiscsi0: 2 targets
cd0 at scsibus0 targ 0 lun 0: <CREATIVE, CD3231E  UC100, 1.00> SCSI0
5/cdrom removable
cd0: can use 32-bit, PIO mode 4, DMA mode 2
pciide0: channel 1 interrupting at irq 15
cd0(pciide0:1:0): using PIO mode 4, DMA mode 2 (using DMA data
transfers)
"VIA VT82C586 (Apollo VP) Power Management" rev 0x10 at pci0 dev 7
function 3 not configured
"Texas Instruments 3DLabs Permedia 2" rev 0x01 at pci0 dev 8 function 0
not configured
xl0 at pci0 dev 10 function 0 "3Com 3c905C 100Base-TX" rev 0x74: irq 10
address 00:01:02:29:cf:96
exphy0 at xl0 phy 24: Broadcom 3C905C internal PHY, rev. 6
isa0 at pcib0
isadma0 at isa0
ep0 at isa0 port 0x340/16 irq 11: address 00:50:04:02:97:2f, utp
(default utp)
pcppi0 at isa0 port 0x61
midi0 at pcppi0: <PC speaker>
sysbeep0 at pcppi0
lpt0 at isa0 port 0x378/4 irq 7
npx0 at isa0 port 0xf0/16: using exception 16
pccom0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
pccom1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
vt0 at isa0 port 0x60/16 irq 1: vga 80 col, color, 8 scr, mf2-kbd
pms0 at vt0 irq 12
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
biomask c040 netmask cc40 ttymask dcc2
pctr: user-level cycle counter enabled
mtrr: K6-family MTRR support (2 registers)
dkcsum: wd0 matched BIOS disk 80
dkcsum: wd1 matched BIOS disk 81
root on wd0a
rootdev=0x0 rrootdev=0x300 rawdev=0x302

--------------

/home/data % set
CDPATH=.:/home/data:/var/log:/usr/local
COLUMNS=102
HOME=/home/data
IFS='   
'
KSH_VERSION='@(#)PD KSH v5.2.14 99/07/13.2'
LINES=33
LOGNAME=data
MAIL=/var/mail/data
MAILCHECK=600
OLDPWD=/usr/local/scripts
OPTIND=1
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/local/scripts:/etc:/usr/etc:/home/data/stuff/scripts
PPID=32359
PS1='`pwd` % '
PS2='> '
PS3='#? '
PS4='+ '
PWD=/home/data
RANDOM=25619
SECONDS=1965
SHELL=/bin/ksh
TERM=vt100
TMOUT=0
USER=data
_=set

---------------
/home/data % set -o
Current option settings
allexport      on   interactive    on   noglob         off 
privileged     off  viraw          off 
braceexpand    off  keyword        off  nohup          on  
restricted     off  vi-show8       off 
bgnice         off  login          on   nolog          off 
sh             off  vi-tabcomplete on  
emacs          on   markdirs       off  notify         off 
stdin          on   vi-esccomplete off 
errexit        off  monitor        on   nounset        off 
trackall       off  xtrace         off 
gmacs          off  noclobber      off  physical       off 
verbose        off  
ignoreeof      off  noexec         off  posix          off 
vi             off 


Thanks,
-Scott Bailey