Magnus Therning
magnus at therning.org
Fri Oct 28 04:15:03 CDT 2005
On Thu, Oct 27, 2005 at 11:12:00PM +0100, dean at deansas.org wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Magnus Therning wrote:
>> On Thu, Oct 27, 2005 at 12:25:14PM +0100, Chris Beauchamp wrote:
>>
>>>Magnus Therning wrote:
>>>
>>>
>>>>What you could do is make sure it's only done once, i.e. for the first
>>>>terminal that's started. Sticking something like this in ~/.bashrc might
>>>>do:
>>>>
>>>> [[ -f /tmp/todo_done ]] || ( cat ~/TODO; touch /tmp/todo_done )
>>>
>>>Of course, this will only ever display it once, and for only one user...
>>>a refinement maybe:
>>>
>>>
>>>[[ -f /tmp/todo_done$USER ]] || ( cat ~/TODO; touch /tmp/todo_done$USER )
>>>
>>>and in /etc/crontab
>>>
>>>0 6 * * * root rm /tmp/todo_done*
>>>
>>>to delete all the flags at 6am
>>
>>
>> It might be further refined for multi-user use:
>>
>> [[ ! -f /tmp/todo_done$USER -a -f ~/TODO ]] && \
>> ( cat ~/TODO; touch /tmp/todo_done$USER )
>>
>> That can then be put in /etc/bash.bashrc.
>>
>> /M
>
>Hi,
>
>Couldn't you just do this (I've not tested either of these btw):
>
>RUNNING=`ps | grep bash | grep -v grep`
Personally I'd use `pgrep`, but the above would work as well.
>if [ -z "$RUNNING" ]
>then
>cat ~TODO
>fi
>
>
>It saves creating a temporary file and using the crontab then.
It all comes down to what kind of behaviour you want "once-per-login"
(the first option, actually more like "once-per-boot"), "once-per-day"
(use crontab). Yours is more like "everytime-bash-is-lonely" (in lack of
a better description).
/M
--
Magnus Therning (OpenPGP: 0xAB4DFBA4)
magnus at therning.org
http://therning.org/magnus
Software is not manufactured, it is something you write and publish.
Keep Europe free from software patents, we do not want censorship
by patent law on written works.
Dizzyclaimer:
If you believe this is in any way, shape, or form actual official
information or opinion, then you are probably as confused if not more
so than I am... I think...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.ubuntu.com/archives/ubuntu-uk/attachments/20051028/c3459798/attachment.pgp
More information about the ubuntu-uk
mailing list