From a0dfc5fd09df52aca01ca173e6961029731faa08 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Sat, 18 Dec 2021 03:02:02 +0100 Subject: [PATCH] Add aliases for different python versions --- home/.config/shell/aliases | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/home/.config/shell/aliases b/home/.config/shell/aliases index 60d4f2f..d16038d 100755 --- a/home/.config/shell/aliases +++ b/home/.config/shell/aliases @@ -78,11 +78,19 @@ alias zi='z -I' # cd with interactive fzf selection alias zbi='z -b -I' # pick parent directory to cd into with fzf # Python -alias py3='python3' -alias py2='python2' alias ipy='ipython' alias bpy='bpython' command -v ipython > /dev/null && alias py='ipython' || alias py='python' +for version in "2 3 3.6 3.7 3.8 3.9 3.10"; do # Make aliases for py3.6,py3.7,... + if ! command -v "python$version" > /dev/null; then + continue + fi + if command -v "ipython$version" > /dev/null; then + alias "py$version"="ipython$version" + else + alias "py$version"="python$version" + fi +done # Fallbacks command -v hd > /dev/null || alias hd='hexdump -C' # Cannonical hex dump; some systems have this symlinked