From 4ba1e8cad03ea8a7c649f0ade10656b6f1aa8a85 Mon Sep 17 00:00:00 2001 From: 1xtier Date: Sun, 30 Mar 2025 01:32:05 +0400 Subject: [PATCH] edit --- .bashrc | 24 ++++++++++++++++++++++-- .zshrc | 17 +++++++++++++++++ alias/zsh_aliases | 1 + 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/.bashrc b/.bashrc index c4b0758..966dbeb 100644 --- a/.bashrc +++ b/.bashrc @@ -1,5 +1,26 @@ # .bashrc - +# COnfigure PS1 Begin +INPUT_COLOR="\[\033[0m\]" +DIR_COLOR="\[\033[0;33m\]" +DIR="\w" +LINE_VC="\342\224\200" +LINE_CN_1="\342\224\214" +LINE_CN_2="\342\224\224" +LINE_CR="\[\033[0;37m\]" +USER="\[\033[0;35m\]\u@" +HOST="\[\033[0;32m\]<\h>" +SYMBOL="\[\033[0;32m\]" +TEST="\[\033[0m\]>" + +if [[ ${EUID} == 0 ]]; then + USER="\[\033[0;31m\]\u@" + HOST="\[\033[0;32m\]\h" + SYMBOL="\[\033[0;31m\]" + TEST="\[\033[0m\]>>" +fi + +export PS1="$LINE_CR$LINE_CN_1$LINE_VC $USER$HOST $DIR_COLOR$DIR \n$LINE_CR$LINE_CN_2$LINE_VC $SYMBOL$TEST $INPUT_COLOR" +# Configure PS1 end # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc @@ -10,7 +31,6 @@ if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]; then PATH="$HOME/.local/bin:$HOME/bin:$PATH" fi export PATH -export PS1="\e[0;34m\u\e[0m:\e[0;31m\h\e[0m\e[0;32m:\W> \e[0m" # Uncomment the following line if you don't like systemctl's auto-paging feature: # export SYSTEMD_PAGER= diff --git a/.zshrc b/.zshrc index 9e3fb4d..ebfe35b 100644 --- a/.zshrc +++ b/.zshrc @@ -98,6 +98,23 @@ done | sort return 0 } compdef myalias +sshc() { + local RED=$(tput setaf 1) + local GREEN=$(tput setaf 2) + local normal=$(tput sgr0) + echo "My custom aliases SSH-config:" + printf "%-18s %s\n" "Name" "Hostname" + echo "------------------------------" + # cat ~/.ssh/config.d/$1.conf | while read line || [[ -n $line ]]; + # do + for file in ~/.ssh/config.d/$1.conf; do + host=$(grep -w 'Host' $file | awk '{print $2}') + command=$(grep -w 'HostName' $file | awk '{print $2}') + printf "%-25s %s\n" "${RED}$host${normal}" "${GREEN}$command${normal}" +done +return 0 +} +compdef myalias # Load files alias if [ -f ~/.dotfiles/alias/zsh_aliases ]; then . ~/.dotfiles/alias/zsh_aliases diff --git a/alias/zsh_aliases b/alias/zsh_aliases index 1eef9d8..8cfd2df 100644 --- a/alias/zsh_aliases +++ b/alias/zsh_aliases @@ -13,3 +13,4 @@ alias gc='git commit -m' alias gp="git push" alias T="tmux attach -t Work || tmux new -s Work" alias t-help="~/.dotfiles/sh/./tmux-help" +alias ccom="sudo minicom -b $1 -D /dev/tty$2 "