Try to use printf instead of echo
Fix the diffs alias Use `dig` to get wan ip for ippub alias Use `ip` instead of `ifconfig` for ippriv alias Fix the lowercase function Delete some tab
This commit is contained in:
parent
74d8b4c8e7
commit
81fe04e381
12
CHANGELOG
12
CHANGELOG
|
@ -1,3 +1,15 @@
|
||||||
|
2014-09-27 1.0.3
|
||||||
|
Features update:
|
||||||
|
- Try to use printf instead of echo
|
||||||
|
- Fix the diffs alias
|
||||||
|
- Use `dig` to get wan ip for ippub alias
|
||||||
|
- Use `ip` instead of `ifconfig` for ippriv alias
|
||||||
|
- Fix the lowercase function
|
||||||
|
- Delete some tab
|
||||||
|
|
||||||
|
2014-09-27 1.0.2
|
||||||
|
Small feature update for login session: possibility to disable X session.
|
||||||
|
|
||||||
2014-09-08 1.0.1
|
2014-09-08 1.0.1
|
||||||
Fix release:
|
Fix release:
|
||||||
|
|
||||||
|
|
22
zshrc
22
zshrc
|
@ -192,7 +192,7 @@ alias mkdir='mkdir -p'
|
||||||
#La commande tree "basique" fait ça très bien ...
|
#La commande tree "basique" fait ça très bien ...
|
||||||
|
|
||||||
# Affiche la variable $PATH ligne par ligne
|
# Affiche la variable $PATH ligne par ligne
|
||||||
alias path='echo $PATH | tr ":" "\n" '
|
alias path='printf %s $PATH | tr ":" "\n" '
|
||||||
|
|
||||||
# Edite le dernier fichier d'un dossier
|
# Edite le dernier fichier d'un dossier
|
||||||
## Fonctionement:
|
## Fonctionement:
|
||||||
|
@ -208,7 +208,7 @@ alias vnb='vi -n "+set noundofile" "+set nobackup"'
|
||||||
|
|
||||||
# Différence entre deux fichiers
|
# Différence entre deux fichiers
|
||||||
alias diff='colordiff -u'
|
alias diff='colordiff -u'
|
||||||
alias diffs='diff --side-by-side'
|
alias diffs='\diff --side-by-side'
|
||||||
|
|
||||||
# Recherche toutes les occurences de l'arguments passé en paramètre dans l'historique des commandes
|
# Recherche toutes les occurences de l'arguments passé en paramètre dans l'historique des commandes
|
||||||
alias param='fc -l 0 | grep'
|
alias param='fc -l 0 | grep'
|
||||||
|
@ -322,35 +322,36 @@ function listalias(){
|
||||||
function ippub()
|
function ippub()
|
||||||
{
|
{
|
||||||
#curl ifconfig.me
|
#curl ifconfig.me
|
||||||
wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d" " -f 6 | cut -d\< -f 1
|
|
||||||
}
|
|
||||||
#lynx --dump http://www.whatismyip.com/|grep Your|awk '{print $4}'
|
#lynx --dump http://www.whatismyip.com/|grep Your|awk '{print $4}'
|
||||||
|
#wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d" " -f 6 | cut -d\< -f 1
|
||||||
|
dig +short myip.opendns.com @resolver1.opendns.com
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#Récupère l'adresse IP (privee)
|
#Récupère l'adresse IP (privee)
|
||||||
function ippriv()
|
function ippriv()
|
||||||
{
|
{
|
||||||
echo "eth0: `ifconfig eth0|grep "inet adr"|awk '{print $2}'|awk -F ':' '{print $2}'`"
|
printf 'eth0: %s\n' $(ip a s eth0|grep "inet "|awk '{print $2}')
|
||||||
echo "wlan0: `ifconfig wlan0|grep "inet adr"|awk '{print $2}'|awk -F ':' '{print $2}'`"
|
printf 'wlan0: %s\n' $(ip a s wlan0|grep "inet "|awk '{print $2}')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#Renomme les fichiers en minuscule
|
#Renomme les fichiers en minuscule
|
||||||
function lowercase()
|
function lowercase()
|
||||||
{
|
{
|
||||||
for file ; do
|
for file in *; do
|
||||||
filename=${file##*/}
|
filename=${file##*/}
|
||||||
case "$filename" in
|
case "$filename" in
|
||||||
*/*) dirname==${file%/*} ;;
|
*/*) dirname==${file%/*} ;;
|
||||||
*) dirname=.;;
|
*) dirname=.;;
|
||||||
esac
|
esac
|
||||||
nf=$(echo $filename | tr A-Z a-z)
|
nf=$(printf $filename | tr A-Z a-z)
|
||||||
newname="${dirname}/${nf}"
|
newname="${dirname}/${nf}"
|
||||||
if [ "$nf" != "$filename" ]; then
|
if [ "$nf" != "$filename" ]; then
|
||||||
mv "$file" "$newname"
|
mv "$file" "$newname"
|
||||||
echo "lowercase: $file --> $newname"
|
printf 'lowercase: %s --> %s\n' ${file} ${newname}
|
||||||
else
|
else
|
||||||
echo "lowercase: $file not changed."
|
printf 'lowercase %s not changed\n' ${file}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -1014,4 +1015,3 @@ setopt extendedglob
|
||||||
# `ls ^*.log` listera tous les fichiers exceptés *.log
|
# `ls ^*.log` listera tous les fichiers exceptés *.log
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue