Edit this page | Blame

Useful Shell Scripts

I make it a habit to put all my user-scripts in `~/bin/' and add that to my `$PATH'. Another useful tip is to prepend all my scripts using a "," - this allows me to quickly take advantage of zsh's autocomplete. For the curious, you could also adopt quiuy as part of the scripts - it has the advantage of adding more semantic meaning to your scripts.

Most of these scripts were borrowed from:

Here are the scripts that make me more efficient on the terminal:

#!/bin/sh
set -eo pipefail

# Run a command in specific directory
run_within_dir() {
    target_dir="$1"
    previous_dir=$(pwd)
    shift
    cd $target_dir && "$@"
    cd $previous_dir
}

run_within_dir $@

If you are in `$HOME', you can do something like: "run-within-dir /tmp"

#!/bin/env sh

# To run this use source!

GUIX_PROFILE="$(guix package --list-profiles | fzf --multi)"

export GUIX_PROFILE
. "$GUIX_PROFILE/etc/profile"
#!/bin/env sh

emacsclient --eval "(projectile-vc \"$PWD/$@\")"

Should these scripts become too many, a repository will be created and a link added to point there.

(made with skribilo)