complete sudo and xkcd script
This commit is contained in:
parent
aa108e1124
commit
981378f061
2 changed files with 18 additions and 0 deletions
5
bashrc
5
bashrc
|
@ -194,6 +194,8 @@ alias bs="curl -s http://cbsg.sourceforge.net/cgi-bin/live | grep -Eo '^<li>.*</
|
|||
|
||||
alias jq="jq -C"
|
||||
|
||||
#alias xkcd='curl https://xkcd.com/info.0.json 2> /dev/null| \jq ".img" | xargs feh'
|
||||
|
||||
#Old ps1
|
||||
#PS1='[\u@\h \W]\$ '
|
||||
|
||||
|
@ -349,6 +351,9 @@ fi
|
|||
|
||||
#If on work computer, cd into sites
|
||||
|
||||
#Add tab completeion to sudo commands
|
||||
complete -cf sudo
|
||||
|
||||
clear
|
||||
#screenfetch
|
||||
#set -o vi
|
||||
|
|
13
bin/xkcd
Executable file
13
bin/xkcd
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/bash
|
||||
comic=$1
|
||||
if [[ "$comic" == "" ]]; then
|
||||
json=$(curl https://xkcd.com/info.0.json 2> /dev/null)
|
||||
elif [[ "$comic" == "random" ]] || [[ "$comic" == "r" ]]; then
|
||||
latest=$(curl https://xkcd.com/info.0.json 2> /dev/null | /usr/bin/jq ".num")
|
||||
number=$(shuf -i1-$latest -n1)
|
||||
json=$(curl https://xkcd.com/$number/info.0.json 2> /dev/null)
|
||||
else
|
||||
json=$(curl https://xkcd.com/$comic/info.0.json 2> /dev/null)
|
||||
fi
|
||||
echo $json | /usr/bin/jq -C
|
||||
echo $json | /usr/bin/jq ".img" | xargs feh
|
Loading…
Add table
Add a link
Reference in a new issue