[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[screen-devel] PATCH: new 'if' primitive
From: |
Steve Kemp |
Subject: |
[screen-devel] PATCH: new 'if' primitive |
Date: |
Tue, 21 Oct 2008 19:08:46 +0100 |
User-agent: |
Mutt/1.5.17+20080114 (2008-01-14) |
To build upon the previously submitted alias primitive I've
added support for 'if'.
I'll submit this change here for potential inclusion, or discussion.
It could be improved with the addition of support for "else", but so far
I've not had the need.
Sample usage:
if -x /usr/bin/cmatrix 'idle 420 eval "screen -t cmatrix /usr/bin/cmatrix
-f -o -u 10" "idle 0"'
The function is used as:
if [test] [test arg] "string 1" "string 2" ... "string N"
If the test succeeds then each "string" will be passed to eval. The
tests are basic and are:
-e file -> True if file exists.
-d file -> True if file is a directroy.
-x file -> True if executable file.
hostname str -> True if hostname matches str.
username str -> True if username matches str.
Each test may be inverted via a "!" prefix, such as :
if !-e /etc/passwd "echo 'system broken?'"
Patch against git tree attached.
My version obviously has this applied already:
http://www.steve.org.uk/Software/tscreen/
Steve
--
http://www.steve.org.uk/
if.diff
Description: Text Data
- [screen-devel] PATCH: new 'if' primitive,
Steve Kemp <=