# ------------ #
# sh functions #
# ------------ #

# replace "cd ../..", "cd ..", etc with "up 2", "up"
up() {
	local d=""
	limit=$1
	for ((i=1; i<=limit; i++))
	do
		d=$d/..
	done
	d=$(echo $d | sed 's/^\///')
	if [ -z "$d" ]; then
		d=..
	fi
	cd $d
}

upload() { curl -F"file=@$1" https://envs.sh; }
pbecho() { curl -F"file=@-;" https://envs.sh; }

# read anything as manpage
mn() {
	pandoc -s -t man "$1" | man -l
}
