From: Laurianne Gardeux on
Le Sun, 20 Apr 2008 00:06:22 +0200, BruXy a �crit�:

> ...
> There was an idea at the beginning. It should not be
> a problem to made a simple audio oscilloscope in BASH!
> ...
> clear; hexdump -v -e '1/1 "%u\n"'</dev/dsp|(while read \
> s; do c=$(((c+1)%COLUMNS));s=$((s*LINES/255));echo -ne \
> "\e[${u[c]};${c}H \e[${s};${c}Hx" ; u[c]=$s ; done )
> ...
> I cannot leave this challenge unheard! And there is a fully
> graphical version:
>
> while true; do echo -e "P5\n256 512\n255" > o.pgm;i=0; dd \
> if=/dev/dsp bs=1024 count=1 | hexdump -v -e '1/2 "%u\n"' |\
> (while read s;do s=$((s>>8));if [ $i -ge 512 ];then exit;fi;
> printf "%*c" $s z;s=$((256-s));printf "%*c" $s A;i=$((i+1));
> done)>>o.pgm;(display -rotate 90 o.pgm &);sleep 1; killall \
> display; done #(c) 2008 BruXy #

Cool, thanks a lot! Now y can watch my music.

> And how did you spend your Saturday evening? :-)

this way:

----------------------------------------------------------

#!/bin/bash

# show numbers of blocks, bytes, directories and files in a directory
# (c) 2006, 2008 by Laurianne Gardeux, GPL
# usage: $0 path
# bugs: filenames ending with ":" are ignored, ...

if [ $# = 0 ]; then
echo "$(basename $0): enter path!"
exit
fi

mkdir -p $HOME/tmp
TMPFILE=$HOME/tmp/ordnergewicht

ls -lRAsp $1 | grep -v ^$ | grep -v \:$ > $TMPFILE

awk ' \
{ sum1 += $1 } \
{ sum2 += $6 } \
END { print sum1, "blocks", "\n" sum2, "bytes" } \
' < $TMPFILE

echo "$(grep \/$ $TMPFILE | wc -l) directories
$(grep -v \/$ $TMPFILE | grep -v ^'total ' | wc -l) files"

rm $TMPFILE

exit

---------------------------------------------------------
bash on GNU-Linux