View Single Post
  #1   (View Single Post)  
Old 4th January 2016
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,507
Default xterm default shell differences between OpenBSD and FreeBSD/NetBSD

I digested about 1/3 of a book on shell scripting and have been trying to add weather information to an openbox window manager.
The following works with the default shell in FreeBSD and NetBSD:
~/scripts/weather.sh
Code:
#!/bin/sh
curl -sk http://weather.noaa.gov/pub/data/observations/metar/decoded/KYKM.TXT | \
fold -w 78 -s
echo ""
read -p "<Enter to Close>" nothing
Which I call with the following openbox menu entry
Code:
xterm -g 78x16+150+38 -T "Yakima, WA Weather" -e ~/scripts/weather.sh
When I try the same script/menu entry in OpenBSD the xterm does not wait for "read" input and closes immediately.

Using $ xterm -hold -e ~/scripts/test.sh I get the following:
Code:
YAKIMA AIR TERMINAL, WA, United States (KYKM) 46-34N 120-32W 324M
Jan 04, 2016 - 04:53 PM EST / 2016.01.04 2153 UTC
Wind: Calm:0
Visibility: 10 mile(s):0
Sky conditions: mostly cloudy
Temperature: 30.0 F (-1.1 C)
Dew Point: 21.9 F (-5.6 C)
Relative Humidity: 71%
Pressure (altimeter): 29.82 in. Hg (1009 hPa)
ob: KYKM 042153Z 00000KT 10SM BKN014 M01/M06 A2982 RMK AO2 SLP112 T10111056
cycle: 22

./test.sh[5]: read: -p: no coprocess
Ideally, I would like the scripts to be portable. Can someone give me a brief explanation and suggestions about how to script this for OpenBSD? Ultimately, I would like to pass the output into a dialog program like zenity or yad.

Last edited by shep; 5th January 2016 at 02:51 AM. Reason: added output from OpenBSD 5.8
Reply With Quote