![]() |
|
Programming C, bash, Python, Perl, PHP, Java, you name it. |
![]() |
|
Thread Tools | Display Modes |
|
|||
![]()
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 Code:
xterm -g 78x16+150+38 -T "Yakima, WA Weather" -e ~/scripts/weather.sh 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 Last edited by shep; 5th January 2016 at 02:51 AM. Reason: added output from OpenBSD 5.8 |
|
|||
![]()
I always use printf(1) to print/echo the prompt.
Code:
#read -p "<Enter to Close>" nothing printf "<Enter to Close> " ; read nothing $ xterm -e 'shep.sh' the new xterm prompts me properly and only closes when I press the Enter key;Code:
[snip] ressure (altimeter): 29.82 in. Hg (1009 hPa) ob: KYKM 042358Z 08004KT 10SM SCT018 BKN070 BKN100 M02/M06 A2982 RMK AO2 T10221061 cycle: 0 <Enter to Close>
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
![]()
Thanks
|
|
||||
![]()
For some reason many people are confused about that. I once remember someone insisting that there's no difference between the terminal and shell :-/
At any rate, "What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?" might be worth reading as well.
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. |
|
|||
![]() Quote:
. The problem I ran into with the book I purchased is that different syntax specifications for the various shells were scattered all through the book. Although I have a rough idea about operators, declaring variables and flow, I am not at all facile with OpenBSD's modified Korn shell. |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Underlegend Networks - NetBSD free shell server | muflon | Off-Topic | 1 | 8th September 2015 01:53 PM |
Differences between the Linux and BSD world summarized | harishankar | Other OS | 6 | 18th December 2013 12:05 PM |
xterm is not a login shell except on blackbox | daemonfowl | NetBSD General | 6 | 1st August 2012 03:59 AM |
Differences in processing in POWER CPUs. | Ninguem | General Hardware | 5 | 25th August 2011 03:30 PM |
BSD UNIX Toolbox: 1000+ Commands for FreeBSD, OpenBSD and NetBSD | anomie | Book reviews | 8 | 28th July 2008 09:32 PM |