Code: Select all
spl(){ echo $1 | aspell -a; }
Code: Select all
spl(){ echo $1 | aspell -a; }
Code: Select all
#!/bin/bash
# store the current dir
CUR_DIR=$(pwd)
# Let the person running the script know what's going on.
echo -e "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
# Find all git repositories and update it to the master latest revision
for i in $(find . -name ".git" | cut -c 3-); do
echo -e "";
echo -e "\033[33m"+$i+"\033[0m";
# We have to go to the .git parent directory to call the pull command
cd "$i";
cd ..;
# finally pull
git pull;
# lets get back to the CUR_DIR
cd $CUR_DIR
done
echo -e "\n\033[32mComplete!\033[0m\n"
Code: Select all
wget https://raw.github.com/DebianJoe/killxdots/master/kxt
Code: Select all
nl -b a </path/to/file/>
Code: Select all
nl --help
I am using the following for a similar task:DebianJoe wrote:Code: Select all
nl -b a </path/to/file/>
Code: Select all
less -JN
Code: Select all
cat -b </path/to/file/>
Code: Select all
sed -i "line#i thetexttoadd" path/to/file
Code: Select all
sed -i "50i hsetroot -fill /data/walls/escalator.png" ~/.xinitrc
Code: Select all
cat -b ~/.xinitrc
# check at what line to insert
sed -i "50i hsetroot -fill /data/walls/escalator.png" ~/.xinitrc
Code: Select all
## be like vim
set editing-mode vi
set keymap vi-command
## quick command repeat (while in ESC mode)
"p": "i !!*\r"
Code: Select all
dofi()
{
# Which text editor do you Prefer ?
deditor=vim
# Where are your Dotfiles ?
dfile1="$HOME/.vimrc"
dfile2="$HOME/.bashrc"
dfile3="$HOME/.bash_profile"
dfile4="$HOME/.bash_aliases"
dfile5="$HOME/.bash_functions"
dfile6="$HOME/.Xresources"
dfile7="$HOME/.xinitrc"
dfile8="$HOME/.mpd/mpd.conf"
dfile9="$HOME/.ncmpcpp/config"
dfile10="$HOME/.config/dunst/dunstrc"
dfile11="$HOME/.config/mpv/mpv.conf"
dfile12="$HOME/.i3/config"
dfile13="$HOME/.config/sxhkd/sxhkdrc"
dfile14="$HOME/.config/compton.conf"
dfile15="$HOME/.tmux.conf"
# Define your arguments ( NOTE: The argument(s) numbering must be same as the dotfile location, i.e. variable darg1 should call dfile1. )
# Longer arguments ( Because You have Tab Completion! )
darg1='vim'
darg2='bash'
darg3='profile'
darg4='aliases'
darg5='functions'
darg6='xresources'
darg7='xinit'
darg8='mpd'
darg9='ncmpcpp'
darg10='dunst'
darg11='mpv'
darg12='i3'
darg13='sxhkd'
darg14='compton'
darg15='tmux'
# Shorter arguments ( What ? Why didn't you install 'bash-completion' ? )
#darg1='vi'
#darg2='bash'
#darg3='prof'
#darg4='alas'
#darg5='func'
#darg6='xres'
#darg7='xin'
#darg8='mpd'
#darg9='ncmp'
#darg10='dunst'
#darg11='mpv'
#darg12='i3'
#darg13='sxhk'
#darg14='comp'
#darg15='tmux'
# Tab Completion for dofi arguments.
function auto-complete_dofi
{
local OPTIONS='$darg1 $darg2 $darg3 $darg4 $darg5 $darg6 $darg7 $darg8 $darg9 $darg10 $darg11 $darg12 $darg13 $darg14 $darg15 --help'
COMPREPLY=()
if [[ $COMP_CWORD -ge 1 ]] ; then
local current_word="${COMP_WORDS[COMP_CWORD]}"
if [[ $COMP_CWORD -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "$OPTIONS" -- "$current_word") )
return 0
fi
fi
}
complete -F auto-complete_dofi dofi
# Help!
function help_dofi
{
esc=""
reset="${esc}[0m"
greenf="${esc}[32m"
redf="${esc}[31m"
bold="${esc}[1m"
cat << EOF
Usage:
${bold}${greenf} dofi ${reset} [OPTION]
Options:
${bold}${redf} $darg1 ${reset} $dfile1
${bold}${redf} $darg2 ${reset} $dfile2
${bold}${redf} $darg3 ${reset} $dfile3
${bold}${redf} $darg4 ${reset} $dfile4
${bold}${redf} $darg5 ${reset} $dfile5
${bold}${redf} $darg6 ${reset} $dfile6
${bold}${redf} $darg7 ${reset} $dfile7
${bold}${redf} $darg8 ${reset} $dfile8
${bold}${redf} $darg9 ${reset} $dfile9
${bold}${redf} $darg10 ${reset} $dfile10
${bold}${redf} $darg12 ${reset} $dfile12
${bold}${redf} $darg13 ${reset} $dfile13
${bold}${redf} $darg14 ${reset} $dfile14
${bold}${redf} $darg15 ${reset} $dfile15
${bold}${redf} -h, --help ${reset} Show this help.
EOF
}
case "$1" in
"$darg1")
$deditor $dfile1
;;
"$darg2")
$deditor $dfile2
;;
"$darg3")
$deditor $dfile3
;;
"$darg4")
$deditor $dfile4
;;
"$darg5")
$deditor $dfile5
;;
"$darg6")
$deditor $dfile6
;;
"$darg7")
$deditor $dfile7
;;
"$darg8")
$deditor $dfile8
;;
"$darg9")
$deditor $dfile9
;;
"$darg10")
$deditor $dfile10
;;
"$darg11")
$deditor $dfile11
;;
"$darg12")
$deditor $dfile12
;;
"$darg13")
$deditor $dfile13
;;
"$darg14")
$deditor $dfile14
;;
"$darg15")
$deditor $dfile15
;;
"-h")
help_dofi
;;
"--help")
help_dofi
;;
*)
echo -e "${bold}${greenf}\n dofi ${reset}${bold}what ?${reset}\n Let me fetch help for you." && help_dofi
;;
esac
}
Code: Select all
#!/bin/bash
search=$1
pathtype=""
confirm=""
find / -name *$search* | while read line
do
if [ -f $line ]
then
printf "$line ... Remove File? [y/n] "
pathtype="file"
read confirm </dev/tty
elif [ -d $line ]
then
printf "$line ... Remove Directory? [y/n] "
pathtype="directory"
read confirm </dev/tty
fi
if [[ $confirm = "y" || $confirm = "Y" ]]
then
if [ $pathtype = "file" ]
then
rm $line
else
rm -r $line
fi
fi
done