other/functions.sh

21 lines
673 B
Bash

#!/bin/bash
function google {
# https://www.commandlinefu.com/commands/view/12128/google-verbatim-search-on-your-terminal
Q="$@";
GOOG_URL='https://www.google.de/search?tbs=li:1&q=';
AGENT="Mozilla/4.0";
stream=$(curl -A "$AGENT" -skLm 10 "${GOOG_URL}${Q//\ /+}" | grep -oP '\/url\?q=.+?&amp' | sed 's|/url?q=||; s|&amp||');
echo -e "${stream//\%/\x}";
}
google word1 word2 word3
########################
function printdir {
# Prints a graphical directory tree from your current directory Show Sample Output
ls -R "$1" | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
}
printdir $dir