![]()
#!/bin/sh
#random-sound.sh: play a random file from the sounds directory
cd $HOME/sounds
filename=$(find -type f |
awk 'BEGIN{
srand()
}
{
names[NR]=$0
}
END{
i=1+int(rand()*NR)
print names[i]
}
')
echo "$filename"
wavplay "$filename"
#!/bin/sh
for i in /var/spool/atjobs/*
do
file=`basename $i`
case $file in
'*') exit 1 ;;
esac
echo $file
sed -n '/cd \/usr\/home\/paul/,/^$/p' < $i | sed '/cd \/usr\/home\/paul/d'
done
#!/bin/sh
#overwrite: overwrite file with output of command
#note: must use redirection of input from file in command if required
opath=$PATH
PATH=/bin:/usr/bin:/usr/local/bin
case $# in
0|1) echo 'Usage: overwrite file cmd [args]' 1>&2; exit 2
esac
file=$1; shift
new=/tmp/overwr1.$$; old=/tmp/overwr2.$$
trap 'rm -f $new $old; exit 1' 1 2 15
export PATH=$opath;
if "$@" > $new
then
cp $file $old
trap '' 1 2 15
cp $new $file
else
echo "overwrite: $1 failed, $file unchanged" 1>&2
rm -f $new $old
exit 1
fi
rm -f $new $old
#!/bin/sh
#dotfiles: list all files beginning with .
ls -a $1 | grep ^[.].*
#!/bin/sh
#fixjpg: convert "Progressive" jpg files to normal jpg
for i in "$@"
do
if djpeg < "$i" | cjpeg > "$i.new"
then
mv "$i.new" "$i"
else
echo "fixjpg: failed on $i"
rm "$i.new"
fi
done
ls -ltr|
grep 'Sep 16'|
sed 's/ */ /g'|
cut -f 9-|
sed 's/ / /g'|
sed -e 's/^/"/' -e 's/$/"/'
#!/bin/sh
# editlots: grep for a string and edit the files containing it
exec vi `grep $1 *|cut -f 1 -d :|sort -u`
#!/bin/sh
#prman: print man page on 65-line device (default is 66)
for i in $*
Do
file=`find /usr/man /usr/local/man -name $i.[0-9]`
sed '1i\
.pl 65
' < $file | groff -man
done
less $(file *|grep script|sed 's/^\([^:]*\):.*/\1/')
rm. Well, since I
use the RCS revision control system, this is simply done: just a ci
<filename>, and I'm right. But then, on occasion I want to look through
stuff that's been "retired" in this way. I can't do a co unless
I know the filename, which is usually not the case. What I really want
is to read through all the old stuff, on the off-chance I find something
worth using, This script does the trick. Note the -p option to
co, sending the file to STDOUT rather than creating a working file.
#!/bin/sh
#rcs.review: have a look at files that have been "retired"
if [ ! -d RCS ]
then
echo "No revision control here! Bailing out"; exit 1
fi
cd RCS
for i in *
do
name=$(echo $i | sed 's/,v$//')
if [ ! -f ../"$name" ]
then
(cd ..; (echo $name; co -p RCS/"$name",v) | less)
fi
done
[back to Scripts index] [back to Linux, Unix, etc] [Main Site] [Weblog]
Contents licensed under the GPL