On Thu, Sep 15, 2011 at 09:49:14AM +0200, Gérard Robin wrote: > Hello, > in order to organize outbox I wrote this script: (year.sh) > > --------------------------------------------------------- > #!/bin/bash > > year=`date +%Y` > > if [ ! -d ~/Mail/OUTBOX/$year ] > then > mkdir ~/Mail/OUTBOX/$year > echo 'set record==OUTBOX/$year/outbox-`date +%m-%y`' > else > echo 'set record==OUTBOX/$year/outbox-`date +%m-%y`' > > fi > ---------------------------------------------------------
The use of '' to enclose the string means bash won't expand any variables inside. Try "" instead. > and in .muttrc I wrote: > > source '~/bin/year.sh |' > > but it is as if $year did not exist. > but if I write the script year.sh like this: > > --------------------------------------------------------- > #!/bin/bash > > an=`date +%Y` > > if [ ! -d ~/Mail/OUTBOX/$an ] > then > mkdir ~/Mail/OUTBOX/$an > echo 'set record==OUTBOX/`date +%Y`/outbox-`date +%m-%y`' > else > echo 'set record==OUTBOX/`date +%Y`/outbox-`date +%m-%y`' > > fi > --------------------------------------------------------- > > it works fine. > > Why it does not work with $an ? Red herring. You're not trying to use $an inside '' in this version. `` still works inside ''. > How to use a variable with mutt ? Hope this helps. -- - Athanasius = Athanasius(at)miggy.org / http://www.miggy.org/ Finger athan(at)fysh.org for PGP key "And it's me who is my enemy. Me who beats me up. Me who makes the monsters. Me who strips my confidence." Paula Cole - ME
signature.asc
Description: Digital signature