KDE Utils: cleanup, hlp
Tags computer mad science, kde, utilities
Features:
See the link below for the "how and why" to install these as symlinks in your HOME/bin folder. Need functions for 'browse', 'launch', 'tofile'? It's all here.
http://www.linuxquestions.org/questi...-tofile-34376/
--------------------
Often we end up with lots of files with tilde suffixes (~) after editing files. Here's a utility to descend several directory levels to quickly 'cleanup' these backups starting with the current directory.
file: cleanup
purpose: remove old backup files
Here's a help display function similar to the 'browse' function but that opens info and man docs, beautifully formatted, for any linux command you need to look up.
file: hlp
purpose: view nice docs without tying up the terminal
Optimizations welcome. These are by now quite old but they work so I haven't felt much inspiration to rework them.
:-)
- Cleanup old backup files quickly with feedback on operations being done.
- Outstanding doc viewer that doesn't tie up your terminal.
See the link below for the "how and why" to install these as symlinks in your HOME/bin folder. Need functions for 'browse', 'launch', 'tofile'? It's all here.
http://www.linuxquestions.org/questi...-tofile-34376/
--------------------
Often we end up with lots of files with tilde suffixes (~) after editing files. Here's a utility to descend several directory levels to quickly 'cleanup' these backups starting with the current directory.
file: cleanup
purpose: remove old backup files
Code:
#!/bin/sh
exists() # not just a link
{
if test -f "$1";then
return 0 # ok
else return 1 # error
fi
}
do_cleanup()
{
for i in $1/*~
do
if exists "$i"; then
echo "$i"
rm -f "$i" >/dev/null
fi
done
for i in $1/*.bak
do
if exists "$i"; then
echo "$i"
rm -f "$i" >/dev/null
fi
done
}
do_cleanup .
for i in *
do
do_cleanup $i
done
for i in */*
do
do_cleanup $i
done
for i in */*/*
do
do_cleanup $i
done
for i in */*/*/*
do
do_cleanup $i
done
for i in */*/*/*/*
do
do_cleanup $i
done
# also remove the typical hidden backups
rm -f \.*~
rm -f */\.*~
rm -f */*/\.*~
rm -f */*/*/\.*~
rm -f */*/*/*/\.*~
rm -f */*/*/*/*/\.*~
echo
echo "done..."
echo
file: hlp
purpose: view nice docs without tying up the terminal
Code:
#!/bin/sh
browser=konqueror
opt="info"
if [ "$1" = "-m" ];then
opt="man"
shift
else
if [ "$1" = "-i" ];then
opt="info"
shift
fi ;fi
if [ "$1" = "" ];then
#update and view ~/bin docs
echo "
Please wait... updating ~/bin docs
if this isn't what you wanted to do, add the subject
you wanted help on on the command line
"
cd ~/bin
./update-docs.exec 2>/dev/null # suppress errors
else
launch "$browser '$opt:$1' >/dev/null 2>&1"
fi
:-)
Total Comments 0




