I've probably tooted about this before, but I don't know why this isn't standard.
It's just so obvious, at least to me. ;)
~ $ type mcd
mcd is a function
mcd ()
{
[[ -n $1 ]] && mkdir "$1" && cd "$1"
}
I've probably tooted about this before, but I don't know why this isn't standard.
It's just so obvious, at least to me. ;)
~ $ type mcd
mcd is a function
mcd ()
{
[[ -n $1 ]] && mkdir "$1" && cd "$1"
}
@rl_dane I also have something like this called "mkdircd" 
More gems I use a lot:
- wping()='curl -Lv "$1"' > /dev/null'
- dctl='systemctl'
- dctlu='systemctl --user' (yes I run some of my own background services + regular miantenance on systemd, bring in the pitchforks
)
Now that I think of it, using netcat would probably be a more efficient implementation of wping, such as
function portcheck {
nc -zw1 "$1" "$2" &>/dev/null
}
function wping {
local port successports=() host="${1:-}"
for port in 80 443; do
portcheck "$host" $port && successports+=($port)
done
case ${#successports[@]} in
0) echo "$host is down"; return 1;;
1) echo "$host is up (port ${successports[@]})";;
*) echo "$host is up (ports ${successports[@]})";;
esac
}