Some changes for macos

This commit is contained in:
Xavier Logerais 2019-06-26 18:29:51 +02:00
parent 799201d887
commit c392e53db5
7 changed files with 34 additions and 14 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash
# Colors
alias ls='ls --color=auto'
alias ls='ls -G'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

2
bashrc
View File

@ -24,7 +24,7 @@ if [ -d $HOME/.bash/aliases ]; then for file in $(ls $HOME/.bash/aliases/*); do
if [ -d $HOME/.bash/aliases.d ]; then for file in $(ls $HOME/.bash/aliases.d/*); do source $file; done; fi
# Source bash completion definitions
for file in /etc/bash*completion /etc/profile.d/bash*completion* ; do source $file ; done
#for file in /etc/bash*completion /etc/profile.d/bash*completion* ; do source $file ; done
if [ -f $HOME/.bash_completion ]; then source $HOME/.bash_completion; fi
if [ -f $HOME/.bash/completion ]; then source $HOME/.bash/completion; fi

View File

@ -1,10 +1,10 @@
#!/bin/bash
#SSH
if [ -e ~/.ssh/config ]; then
complete -W "$(cat ~/.ssh/config | egrep -i "^\s*host\s+[a-zA-Z]" | sed -e "s/^host\s*//i")" ssh
fi
if [ -e ~/.ssh/known_hosts ]; then
complete -W "$(cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e s/,.*//g | uniq | grep -v "\[")" ssh
fi
#if [ -e ~/.ssh/config ]; then
# complete -W "$(cat ~/.ssh/config | egrep -i "^\s*host\s+[a-zA-Z]" | sed -e "s/^host\s*//i")" ssh
#fi
#
#if [ -e ~/.ssh/known_hosts ]; then
# complete -W "$(cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e s/,.*//g | uniq | grep -v "\[")" ssh
#fi

View File

@ -1,5 +1,7 @@
#!/bin/bash
which virsh || return &> /dev/null
hypervisor_connect() {
if [ -e "${1}" ]; then echo "Usage : $0 hypervisor_name_or_ip"; return 1; fi

View File

@ -1,4 +1,4 @@
#!/bin/bash
# Define prefered LANG
export LANG=fr_FR.utf8
export LANG=fr_FR.UTF-8

6
rc.d/direnv Normal file
View File

@ -0,0 +1,6 @@
#!/bin/bash
if (which -s direnv)
then
eval "$(direnv hook bash)"
fi

View File

@ -2,9 +2,24 @@
# Customize the prompt
# Limit the path to 3 levels
PROMPT_DIRTRIM=3
# Use powerline-go if availaible
# -modules string
# The list of modules to load, separated by ','
# (valid choices: aws, cwd, docker, dotenv, duration, exit, git, gitlite, hg, host, jobs, kube, load, newline, nix-shell, node, perlbrew, perms, root, shell-var, ssh, svn, termtitle, terraform-workspace, time, user, venv, vgo)
# (default "nix-shell,venv,user,host,ssh,cwd,perms,git,hg,jobs,exit,root,vgo")
# -modules-right string
# The list of modules to load anchored to the right, for shells that support it, separated by ','
# (valid choices: aws, cwd, docker, dotenv, duration, exit, git, gitlite, hg, host, jobs, kube, load
if (which powerline-go &> /dev/null); then
function _update_ps1() {
PS1="$(powerline-go -error $?)"
#eval $(powerline-go -shell bash -mode patched -modules "nix-shell,cwd,perms,jobs,git,venv,docker,kube,aws" -modules-right "exit,ssh,user,host" -newline -error $? -eval)
eval $(powerline-go -shell bash -mode patched -modules "nix-shell,cwd,perms,jobs,git,venv,aws,docker,kube,exit" -newline -error $? -eval)
}
if [ "$TERM" != "linux" ] ; then
export PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
@ -17,9 +32,6 @@ else
fi
fi
# Limit the path to 3 levels
PROMPT_DIRTRIM=3
# Add a smiley at end of prompt showing last command status code
#smiley() {
# ret_val=$?