6 ms·
Spicing unix shell scripts
- Craiggybear 15y agoLOVE IT!
- ThaddeusQuay2 15y ago"There are some misconceptions that shell scripts are only for a CLI environment. You can easily use various tools to write GUI and/or network (socket) scripts under KDE or Gnome desktops. With the following tools you can build powerful, interactive, user friendly UNIX / Linux bash shell scripts." What's even better is that you can use BaCon to unify, and expand upon, pretty much everything mentioned in the article. BaCon is Basic Converter, created by Peter van Eerten, who also created GTK-server, which provides a stream-oriented interface to GTK, and which can be used with BaCon. Convert your shell scripts to BaCon, which then turns them into C, which is then compiled. Any calls to external commands can remain. Switching from shell scripts to BaCon is easy, you can stick with the tools you know, you can have as much GUI as you like (while remaining at the CLI), and the executables are lightning fast (compared to shell scripts). http://basic-converter.org http://basic-converter.org http://en.wikipedia.org/wiki/GTK-server http://en.wikipedia.org/wiki/GTK-server
- deleted 15y ago[deleted]
- bwarp 15y agoThe only thing I do and would use there is "logger". The rest is about showboating. A GUI and a script should never be entangled if you ask me. There should be no coupling there. Everything script-related should run quite happily non interactive. A GUI could drive a script however via the script's API. I think ESR wrote about this in TAOUP (The Art Of Unix Programming) but I can't be bothered to dig through it now for the reference.
- gbrindisi 15y agoTAOUP?
- pewfly 15y agoThe Art Of Unix Programming
- keeperofdakeys 15y agoPersonally I use notify-send for warnings (such as battery getting low). Even though I do have a separate battery bar, it helps remember to plugin.
- tikhonj 15y agoI've found the notify-send command to be really useful for some of my random scripts. I used it to notify me when a particular web page changed, but I think it could also be very useful for letting me know when a long-running script finished. Some of the other tricks shown here also seem useful.
- drats 15y agoI didn't know about /dev/tcp/host/port, has a nice Plan 9-like feel.
- zdw 15y agoSimilar GUI functionality in OS X can be achieved with cocoaDialog: http://mstratman.github.com/cocoadialog/ http://mstratman.github.com/cocoadialog/ Comes in very handy, along with Platypus for wrapping shell scripts: http://sveinbjorn.org/platypus http://sveinbjorn.org/platypus
- boskonovitch 15y agocool tips, but i'm worried about writing a script which isn't portable because of dependencies to some tools.
- gaius 15y agoSurprised he didn't mention Tcl/Tk as the way to do this.