Added chx() to toggle whether a file is executable
This commit is contained in:
parent
1f57a0d47b
commit
842945ffe8
1 changed files with 20 additions and 3 deletions
23
.zshrc
23
.zshrc
|
@ -59,7 +59,6 @@
|
||||||
## Program improvements (ex: ls = ls -h) >>>
|
## Program improvements (ex: ls = ls -h) >>>
|
||||||
alias df='df -h' # Human-readable sizes
|
alias df='df -h' # Human-readable sizes
|
||||||
alias free='free -m' # Show sizes in MB
|
alias free='free -m' # Show sizes in MB
|
||||||
alias tm='tmux new -As0' # open a new session called 0, but if there is already a session called 0, connect to it
|
|
||||||
alias bc="bc -ql" # Make bc usable for fast math
|
alias bc="bc -ql" # Make bc usable for fast math
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
|
@ -75,6 +74,8 @@
|
||||||
# dotfile management
|
# dotfile management
|
||||||
alias dot='git --git-dir="/home/blake/git/dotfiles" --work-tree="$HOME"'
|
alias dot='git --git-dir="/home/blake/git/dotfiles" --work-tree="$HOME"'
|
||||||
|
|
||||||
|
alias tm='tmux new -As0' # open a new session called 0, but if there is already a session called 0, connect to it
|
||||||
|
|
||||||
# Edit config files
|
# Edit config files
|
||||||
alias \
|
alias \
|
||||||
vimrc="$EDITOR ~/.config/nvim/init.vim" \
|
vimrc="$EDITOR ~/.config/nvim/init.vim" \
|
||||||
|
@ -105,7 +106,8 @@
|
||||||
logs='docker-compose logs --tail=200 -f' \
|
logs='docker-compose logs --tail=200 -f' \
|
||||||
dupd='docker-compose up -d' \
|
dupd='docker-compose up -d' \
|
||||||
ddwn='docker-compose down' \
|
ddwn='docker-compose down' \
|
||||||
occ='docker exec -it nextcloud occ' \
|
dc='docker-compose' \
|
||||||
|
occ='docker exec -it -u www-data nextcloud php occ' \
|
||||||
|
|
||||||
# lists all open ports, along with some other info
|
# lists all open ports, along with some other info
|
||||||
alias ls-ports='netstat -tulpn'
|
alias ls-ports='netstat -tulpn'
|
||||||
|
@ -117,7 +119,7 @@
|
||||||
SMART_PLUG_IP='192.168.1.250'
|
SMART_PLUG_IP='192.168.1.250'
|
||||||
alias l='tplink_smartplug.py -t $SMART_PLUG_IP -c'
|
alias l='tplink_smartplug.py -t $SMART_PLUG_IP -c'
|
||||||
|
|
||||||
# Colors
|
# Common ls aliases
|
||||||
alias \
|
alias \
|
||||||
la='ls -ah' \
|
la='ls -ah' \
|
||||||
ll='ls -lh' \
|
ll='ls -lh' \
|
||||||
|
@ -133,6 +135,21 @@
|
||||||
# optionally source an external function file
|
# optionally source an external function file
|
||||||
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/fnrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/fnrc"
|
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/fnrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/fnrc"
|
||||||
|
|
||||||
|
# toggles whether a file or group of files is executable
|
||||||
|
chx() {
|
||||||
|
for FILE in "$@";do
|
||||||
|
if [ -x "$FILE" ];then
|
||||||
|
chmod -x "$FILE" &&
|
||||||
|
echo -e "$FILE: -x"
|
||||||
|
elif ! [ -x "$FILE" ];then
|
||||||
|
chmod +x "$FILE" &&
|
||||||
|
echo -e "$FILE: +x"
|
||||||
|
else
|
||||||
|
echo "error: file $FILE does not exist" >&2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# Simple extraction script. Taken from manjaro's .bashrc
|
# Simple extraction script. Taken from manjaro's .bashrc
|
||||||
ex() {
|
ex() {
|
||||||
if [ -f $1 ] ; then
|
if [ -f $1 ] ; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue