bash: turn aliases into scripts

This makes the common actions previously encoded as bash aliases
independent of the shell (I'm using /bin/sh for the scripts), which will
make a potential switch to zsh easier by having less bash-specific stuff
around.
This commit is contained in:
Fernando Schauenburg 2021-07-22 17:29:46 +02:00
parent c650622193
commit e44b318e61
8 changed files with 29 additions and 17 deletions

4
bin/,head Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
# Head as much as fits on screen
exec head -n $(echo "$(tput lines) - 5" | bc) "$@"

3
bin/,mpath Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
echo "$MANPATH" | tr -s ":" "\n"

9
bin/,myip Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
# A few options to get public IP address on command line. The dig solution
# below using the OpenDNS resolver doesn't work when connected to
# ExpressVPN because all DNS requests are handled by the ExpressVPN DNS
# servers and the OpenDNS DNS resolver is blocked.
exec curl -s https://ifconfig.co
#exec curl -s https://ifconfig.me
#exec dig +short myip.opendns.com @resolver1.opendns.com

3
bin/,myipinfo Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
exec curl -s ipinfo.io

3
bin/,path Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
echo "$PATH" | tr -s ":" "\n"

4
bin/,tail Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
# Tail as much as fits on screen
exec tail -n $(echo "$(tput lines) - 5" | bc) "$@"

3
bin/,tmux Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
exec tmux -f "$XDG_CONFIG_HOME/tmux/tmux.conf" "$@"

View file

@ -175,23 +175,6 @@ alias vim='nvim'
alias grep="grep --color=auto"
alias egrep="egrep --color=auto"
alias fgrep="fgrep --color=auto"
alias path='echo $PATH | tr -s ":" "\n"'
alias mpath='echo $MANPATH | tr -s ":" "\n"'
alias tmux='tmux -f "$XDG_CONFIG_HOME/tmux/tmux.conf"'
# Head and tail as much as fits on screen
alias head='head -n $((${LINES:-15}-5))'
alias tail='tail -n $((${LINES:-15}-5))'
# A few options to get public IP address on command line. The dig solution
# below using the OpenDNS resolver doesn't work when connected to
# ExpressVPN because all DNS requests are handled by the ExpressVPN DNS
# servers and the OpenDNS DNS resolver is blocked.
alias ipinfo="curl -s ipinfo.io"
alias myip="curl -s https://ifconfig.co"
#alias myip="curl -s https://ifconfig.me"
#alias myip="dig +short myip.opendns.com @resolver1.opendns.com"
alias dark='change_bg dark'
alias light='change_bg light'