1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-05-20 02:43:23 -07:00

use in-place arithmetic where applicable

This commit is contained in:
Connor Olding 2021-07-29 10:40:15 -07:00
parent aaa15067b8
commit 56a5724160
6 changed files with 11 additions and 11 deletions

View File

@ -42,9 +42,9 @@ ADDPATH "$HOME/sh"
> ~/.sh-bash
)
SOURCING=$((SOURCING+1))
: $((SOURCING+=1))
. ~/.sh-bash
SOURCING=$((SOURCING-1))
: $((SOURCING-=1))
# TODO: respect initctl like in .zshrc.
alias reload='cd; exec bash'

View File

@ -62,9 +62,9 @@ function {
[ "$a" = "$b" ] && touch ~/.sh.zwc || zrecompile -p ~/.sh
}
SOURCING=$((SOURCING+1))
: $((SOURCING+=1))
. ~/.sh
SOURCING=$((SOURCING-1))
: $((SOURCING-=1))
local fuzzy=`has fzy || print`

View File

@ -3,9 +3,9 @@
# YES_BASH
# YES_DASH
#SOURCING=$((SOURCING+1))
: $((SOURCING+=1))
#. ~/sh/note # FIXME: don't do this?
#SOURCING=$((SOURCING-1))
: $((SOURCING-=1))
baks() { # backup, timestamped
local ret=0

4
sh/sc
View File

@ -1,8 +1,8 @@
#!/usr/bin/env bash
SOURCING=$((SOURCING+1))
: $((SOURCING+=1))
. ~/sh/ea # FIXME: don't do this? somehow?
SOURCING=$((SOURCING-1))
: $((SOURCING-=1))
sc_shorten() {
REPLY="${1:2:2}${1:5:2}${1:8:2}${1:11:12}"

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash
# YES_ZSH
#SOURCING=$((SOURCING+1))
: $((SOURCING+=1))
#. ~/sh/now # FIXME: don't do this?
#SOURCING=$((SOURCING-1))
: $((SOURCING-=1))
scropt() {
local now=$(now)

2
sh/sum
View File

@ -6,7 +6,7 @@
sum() {
local sum=0
for i; do
sum=$((sum+i))
: $((sum+=i))
done
echo "$sum"
}