Last active
April 22, 2025 06:00
-
-
Save Qu1ck5h0t/518dc908cf57f933048603d6c2e3336c to your computer and use it in GitHub Desktop.
Some code I append to my .bashrc for quality of life improvements.
This file contains hidden or 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
# Allows the user to run .py, .sh and .c implicitly through filename extensions rather than delcaring it in a command. | |
# Note that tempc needs to be installed to run c files. Get it here! -> https://github.com/Qu1ck5h0t/tempc | |
command_not_found_handle() { | |
if [[ "$1" == *.py ]]; then | |
python3 "$1" | |
elif [[ "$1" == *.sh ]]; then | |
chmod +x "$1" | |
./"$1" | |
elif [[ "$1" == *.c ]]; then | |
tempc "$1" | |
else | |
echo "Command not found: $1" | |
return 127 | |
fi | |
} | |
# Clears the terminal by just typing "c" | |
alias c='clear' | |
# Runs the last command in sudo when the user types "please" | |
alias please='sudo $(history -p !!)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment