Shell snippets


Batch conversion of file formats with ffmpeg

$ for i in *.mp3; do ffmpeg -i "$i" "${i%.*}.wav"; done

Tags: shell

Importing env vars from .env file


There's a very quick way of importing all env vars defined in your .env file to the shell session you're currently in.

Adding this to your bash profile will allow you to run dotenv:

alias dotenv='export $(cat .env | grep -v ^# | xargs)'

To remove these variables you can also define unset-dotenv:

alias unset-dotenv='unset $(cat .env | grep -v ^# | sed -E "s/(.*)=.*/\1/" | xargs)'

Tags: env, dotenv, file, shell, bash, import, export, alias