3 ms·
I have 'usb' aliased as my main USB's directory. Making 'cd' more explicit: cd ( ) { builtin cd "$@" echo "$OLDPWD -> $PWD" } Up directory alias .
by yesenadam 8y ago
I have 'usb' aliased as my main USB's directory.
Making 'cd' more explicit:
cd ( ) {
builtin cd "$@"
echo "$OLDPWD -> $PWD"
}
Up directory
alias ..='cd ../'
This one I use to find bits in my favourite books/essays, which I have in folders in /books, under e.g. /books/Shakespeare/Macbeth, then search with 'book to be or' etc.
book () {
# Find occurrences of words in texts. Put folders in ~/books, or soft links (ln -s)
# Displays only complete words found, not parts of words.
GREP_COLOR=red
grep -r -n -i --word-regexp --color -C 1 "$*" ./books/
echo `grep -r -i "$*" ./books/ | wc -l` occurrences of \"$*\" found, `grep -i -r --word-regexp "$*" ./books/ | wc -l` as a whole word.
}
'dlm' downloads mp4 file from URL in clipboard
#!/bin/bash
#dlm - download mp4 from clipboard URL. usage: 'dlm myfile' downloads myfile.mp4
#with resume after 5 secs until finish.
fname=$(pbpaste)
echo "Download $fname as $1.mp4 : "
until curl -C - -kLo $1.mp4 "$fname"
do
sleep 5
done