Categories
bash scripting

mkdir and cd

Here is a bash function I recently added to my dotfiles specifically .bashrc

function mcd() {
    mkdir -vp "$1"
    cd "$1"
}

To use this on my terminal, I need to export this in the same .bashrc file

export -f mcd

So from the command line, I can create and immediately change to the created directory.

mcd name_of_new_folder
Categories
scripting sql

What will be the date x days from now?

Today I learn some nifty shell command. The command simply answers the question, what will be date x days from now. So lets says I wanted to know what will be date and time 13 days from now

echo "select now() + '30 days'::interval" | psql

As you can see from this I am piping into psql (postgresql terminal frontend) so this is simply a SQL statement run from the shell.