#!/bin/bash function addBashProfile() { name="$1"; title="$2"; if [ -t 1 ] then statement="$(cat)"; else statement="${@:3}"; fi; contextRoot="$(mktemp -d)"; pushd "$contextRoot" > /dev/null; { echo '#!/bin/bash'; echo "# $title"; echo "$statement"; } > "profile.sh"; sudo install -Dm755 profile.sh /etc/bash/conf.d/$name.sh popd > /dev/null; rm -rf "$contextRoot"; }