Last active
October 6, 2023 16:43
-
-
Save Mosharush/3a01c378632637939f3c43f3126d7a96 to your computer and use it in GitHub Desktop.
Bash Alias to run last wrong command wrote in Hebrew to the correct command :)
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
alias גררר="replace_hebrew_with_latin" | |
replace_hebrew_with_latin() { | |
previous_command=$(history | tail -n 1 | sed 's/^[ ]*[0-9]*[ ]*//') | |
latin_command=$(echo "$previous_command" | tr 'פםןוטארק׳/ףךלחיעכגדשץתצמנהבסז' 'poiuytrewq;lkjhgfdsa.,mnbvcxz') | |
# Display the translated command | |
echo "Translated Command: $latin_command" | |
# Ask for confirmation before executing | |
echo "Do you want to execute this command? [Press Enter again]" | |
read -r response | |
if [[ "$response" = "" ]]; then | |
eval "$latin_command" | |
else | |
echo "Command execution aborted." | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Accepted 👍
For examples: