#!/bin/sh # Say what to run next, using a path that actually works right now. # # `dotup` lands in ~/.local/bin, and Ubuntu's stock ~/.profile does add that to # PATH -- but behind `[ -d "$HOME/.local/bin" ]`, evaluated once, at login. On # a fresh box the directory does not exist when you log in, so it is not on # PATH; this apply then creates it; and the shell you are sitting in never # re-reads .profile. The result is that `dotup` is "command not found" in # exactly the session that just installed it, and works fine in the next one. # # That cannot be fixed from inside a child process -- nothing here can alter # the PATH of the shell that invoked it. What it can do is stop the user # guessing: print the absolute path, which always works, and say why the bare # name does not yet. # # Silent once PATH is sorted out, so a routine `chezmoi update` says nothing. set -eu command -v dotup >/dev/null 2>&1 && exit 0 [ -x "$HOME/.local/bin/dotup" ] || exit 0 printf '\n' >&2 printf 'Next: ~/.local/bin/dotup\n' >&2 printf '\n' >&2 printf 'Type the path in full. `dotup` on its own will not be found until you\n' >&2 printf 'open a new shell -- ~/.profile only adds ~/.local/bin to PATH if the\n' >&2 printf 'directory already existed when you logged in, and it did not.\n' >&2