[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Pan-users] Re: Shortcuts gone?
From: |
Per Hedeland |
Subject: |
Re: [Pan-users] Re: Shortcuts gone? |
Date: |
Thu, 17 Aug 2006 19:04:09 +0200 (CEST) |
"Duncan" <address@hidden> wrote:
>
>"Mick Semb Wever" <address@hidden> posted
>address@hidden, excerpted below, on Thu, 17 Aug 2006 12:51:17
>+0000:
>
>> It's a bash script printing out random quotes.
>> The section that outputs the text is:
>>
>> echo "-- "
>> echo "${quotes[$RANDOM_NUMBER]}"
>> echo "Homepage - www.wever.org"
>> echo "Sesam Search Engine - www.sesam.no"
>>
>> So it's the ${quotes[$RANDOM_NUMBER]} that comes out in one line.
>> There's probably a way of wrapping it in the bash script as well but my
>> scripting ability isn't good enough to know.
>
>There is. It would involve ${#var}, which returns the number of chars in
>string $var, possibly ${var:n:l}, which returns a substring starting at
>position n (zero-based), length l, and ${var#pattern}, which tests if $var
>begins with pattern and if so deletes the match and returns the rest
>(single hash for shortest match, double for longest) or ${var%pattern},
>(same thing for the end).
>
>Untested/unfinished(?) quick hack solution (I took your bait =8^):
Wow - if it works, I'm mightily impressed. Myself, I would just have
done
echo "${quotes[$RANDOM_NUMBER]}" | fmt
- but then I'm lazy.:-)
>Note that you have two post-quote lines, so if the quote is long enough to
>wrap into more than two lines, you'll violate max sig length netiquette
>and get a warning from pan.
echo "${quotes[$RANDOM_NUMBER]}" | fmt | head -2
:-)
--Per Hedeland
- [Pan-users] Shortcuts gone?, Mick Semb Wever, 2006/08/16
- [Pan-users] Re: Shortcuts gone?, Duncan, 2006/08/16
- Re: [Pan-users] Re: Shortcuts gone?, Bruce Bowler, 2006/08/16
- [Pan-users] Re: Shortcuts gone?, Duncan, 2006/08/17
- [Pan-users] Re: Shortcuts gone?, Mick Semb Wever, 2006/08/17
- [Pan-users] Re: Shortcuts gone?, Mick Semb Wever, 2006/08/17
- Re: [Pan-users] Re: Shortcuts gone?, Brad Sims, 2006/08/17
- Re: [Pan-users] Re: Shortcuts gone?, Christophe Lambin, 2006/08/17