Created
March 26, 2025 12:43
-
-
Save Khazbs/f23731fd82311a1472d0f58abed836d6 to your computer and use it in GitHub Desktop.
AKA for ZSH
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
# Alias definitions. | |
# You may want to put all your additions into a separate file like | |
# ~/.zsh_aliases, instead of adding them here directly. | |
if [ -f ~/.zsh_aliases ]; then | |
. ~/.zsh_aliases | |
fi | |
# Write new alias to ~/.zsh_aliases and source that file. | |
aka() | |
{ | |
local alias_regex='[A-Za-z_0-9]*' | |
if | |
[[ $# = 1 && $1 =~ ($alias_regex)=(.*) ]] | |
then | |
printf "%s\n" "alias ${match[1]}=\"${match[2]}\"" >> ~/.zsh_aliases | |
. ~/.zsh_aliases | |
else | |
echo "Usage: aka ALIAS_NAME=ALIAS_COMMAND" | |
return 1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment