From: Ross Davis (ross at domain skynet.ie)
Date: Thu 31 May 2001 - 04:05:10 IST
> Maybe a little more information about what you're
> trying to accomplish would help?
Thanks for the answers guys. As though I have too much time on my hands I
went toying with the bash PROMPT_COMMAND var.. I was trying to set it to:
PROMPT_COMMAND="echo -e \"\033[0;32m[\$(date +%a\ %b\
%e)](\$NEWDIRSIZE)[\$(jobs | wc -l | awk '{print \$1}')]\033[0m\""
With NEWDIRSIZE coming from:
cd()
{
builtin cd "$ at domain " && NEWDIRSIZE=$(du -sSh | awk '{print $1}')
}
Which incidentally works fine 'cept the prompt returns too slow in my
$HOME dir only. So I was going to background the second command and live
with my prompt not getting updated immediately. Anyways, I've settled on
doing it this way for a while seeing as my $HOME dir doesn't vary in size
much in any one session:
cd()
{
builtin cd "$ at domain "
if [ -O $PWD ] ; then :
if [ $PWD != "/home/ross" ]; then :
NEWDIRSIZE=$(du -sSh | awk '{print $1}')
else
NEWDIRSIZE=$HOMEDIRSIZE
fi
else
NEWDIRSIZE="other"
fi
}
PROMPT_COMMAND="echo -e \"\033[0;32m[\$(date +%a\ %b\
%e)](\$NEWDIRSIZE)[\$(jobs | wc -l | awk '{print \$1}')]\033[0m\""
export NEWDIRSIZE=$(du -sSh | awk '{print $1}')
HOMEDIRSIZE=$NEWDIRSIZE
> > so, your best bet is:
> >
> > cmd1 && (cmd2 > cmd2.out &); var=$(cat cmd2.out); rm cmd2.out
Yeah, I was thinking 'bout doing that Kevin but I figured in this case
doing it
with variables was slow enough already ;)
Thanks again,
-Ross
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:10:31 GMT