Shell: bash gets properly sourced when a non-login shell.
Shell: fixed 'archive' function to work on multiple files with Zsh. Shell: minor fixes.master
parent
a300eab28d
commit
ba99140a99
|
@ -1,27 +1 @@
|
||||||
################################################################################
|
[ -f "$HOME/.bashrc" ] && . .bashrc
|
||||||
## Shell Config -- Master File
|
|
||||||
## Date 2012-08-11
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
##==============================================================================
|
|
||||||
## If not running interactively, don't do anything
|
|
||||||
##==============================================================================
|
|
||||||
[ -z "$PS1" ] && return
|
|
||||||
|
|
||||||
##==============================================================================
|
|
||||||
## Sourcing
|
|
||||||
##==============================================================================
|
|
||||||
|
|
||||||
SHELL_CURRENT="$(ps | awk -v shellpid=$$ '$0 ~ shellpid {print $4}')"
|
|
||||||
SHELL_DIR="$HOME/.shell.d"
|
|
||||||
|
|
||||||
## Should be sourced first.
|
|
||||||
source "${SHELL_DIR}/main_rc"
|
|
||||||
source "${SHELL_DIR}/colors_bash"
|
|
||||||
source "${SHELL_DIR}/options_bash"
|
|
||||||
|
|
||||||
## Source order should not matter.
|
|
||||||
source "${SHELL_DIR}/alias_rc"
|
|
||||||
source "${SHELL_DIR}/funs_rc"
|
|
||||||
source "${SHELL_DIR}/funs_bash"
|
|
||||||
source "${SHELL_DIR}/personal_rc"
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
################################################################################
|
||||||
|
## Shell Config -- Master File
|
||||||
|
## Date 2012-08-11
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
##==============================================================================
|
||||||
|
## If not running interactively, don't do anything
|
||||||
|
##==============================================================================
|
||||||
|
[ -z "$PS1" ] && return
|
||||||
|
|
||||||
|
##==============================================================================
|
||||||
|
## Sourcing
|
||||||
|
##==============================================================================
|
||||||
|
|
||||||
|
SHELL_CURRENT="$(ps | awk -v shellpid=$$ '$0 ~ shellpid {print $4}')"
|
||||||
|
SHELL_DIR="$HOME/.shell.d"
|
||||||
|
|
||||||
|
## Should be sourced first.
|
||||||
|
source "${SHELL_DIR}/main_rc"
|
||||||
|
source "${SHELL_DIR}/colors_bash"
|
||||||
|
source "${SHELL_DIR}/options_bash"
|
||||||
|
|
||||||
|
## Source order should not matter.
|
||||||
|
source "${SHELL_DIR}/alias_rc"
|
||||||
|
source "${SHELL_DIR}/funs_rc"
|
||||||
|
source "${SHELL_DIR}/funs_bash"
|
||||||
|
source "${SHELL_DIR}/personal_rc"
|
|
@ -9,6 +9,7 @@ libpng12
|
||||||
movgrab
|
movgrab
|
||||||
package-query
|
package-query
|
||||||
pacman-color
|
pacman-color
|
||||||
|
pdksh
|
||||||
rxvt-unicode-patched
|
rxvt-unicode-patched
|
||||||
submarine
|
submarine
|
||||||
texlive-dummy
|
texlive-dummy
|
||||||
|
|
|
@ -417,7 +417,6 @@ patch
|
||||||
pciutils
|
pciutils
|
||||||
pcmciautils
|
pcmciautils
|
||||||
pcre
|
pcre
|
||||||
pdksh
|
|
||||||
perl
|
perl
|
||||||
perl-digest-sha1
|
perl-digest-sha1
|
||||||
perl-error
|
perl-error
|
||||||
|
|
4
.save
4
.save
|
@ -232,9 +232,9 @@ FILELIST=(${FILELIST[*]} ".Xresources")
|
||||||
##==============================================================================
|
##==============================================================================
|
||||||
|
|
||||||
if [ "$DEBUG" = "yes" ]; then
|
if [ "$DEBUG" = "yes" ]; then
|
||||||
tar ${ARCOPT} "$ARCHIVENAME" -C "$HOME" ${FILELIST[*]} -C "$SCRIPTPATH" "$(basename "$0")" --exclude-vcs
|
tar ${ARCOPT} "${ARCHIVENAME}.${ARCEXT}" -C "$HOME" ${FILELIST[*]} -C "$SCRIPTPATH" "$(basename "$0")" --exclude-vcs
|
||||||
else
|
else
|
||||||
tar ${ARCOPT} "${ARCHIVENAME}.${ARCEXT}" -C "$HOME" ${FILELIST[*]} -C "$SCRIPTPATH" "$(basename "$0")" --exclude-vcs >/dev/null
|
tar ${ARCOPT} "${ARCHIVENAME}.${ARCEXT}" -C "$HOME" ${FILELIST[*]} -C "$SCRIPTPATH" "$(basename "$0")" --exclude-vcs >/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##==============================================================================
|
##==============================================================================
|
||||||
|
|
|
@ -15,9 +15,8 @@
|
||||||
## This function gets the pacman variables when necessary.
|
## This function gets the pacman variables when necessary.
|
||||||
|
|
||||||
## Note: some functions uses pacman localized output. It should work in any
|
## Note: some functions uses pacman localized output. It should work in any
|
||||||
## case.
|
## case. You should always call _pacman_unset_vars in the end.
|
||||||
|
|
||||||
## Note: you should always call _pacman_unset_vars in the end.
|
|
||||||
_pacman_set_vars()
|
_pacman_set_vars()
|
||||||
{
|
{
|
||||||
local pacman_var_list="$(pacman -Qi tzdata | cut -f1 -d':')"
|
local pacman_var_list="$(pacman -Qi tzdata | cut -f1 -d':')"
|
||||||
|
@ -243,7 +242,7 @@ pacman-deps()
|
||||||
echo
|
echo
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
echo -e " default:\tDisplay package dependencies. Output contains no double and is alphabetically sorted. It will only work for repos packages by default."
|
echo -e " default:\tDisplay package dependencies. Output contains no double and is alphabetically sorted. It will only work for repos packages by default."
|
||||||
echo -e " -a:\t\tUses Yaourt queries instead of repos database. It slows down query but allow displaying size of local any packages not available in repos."
|
echo -e " -a:\t\tUses Yaourt queries instead of repos database. It slows down query but allow displaying size of any packages not available in repos."
|
||||||
echo -e " -h:\t\tShow this help."
|
echo -e " -h:\t\tShow this help."
|
||||||
echo -e " -q:\t\tUses installed packages database instead of repos database. It speeds up queries and allows displaying size of local packages not available in repos."
|
echo -e " -q:\t\tUses installed packages database instead of repos database. It speeds up queries and allows displaying size of local packages not available in repos."
|
||||||
}
|
}
|
||||||
|
@ -296,7 +295,7 @@ pacman-rebuild ()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## TODO: use args to tell what to rebuild.
|
## TODO: use args to tell what to rebuild.
|
||||||
# local PKG_LIST=()
|
# local PKG_LIST
|
||||||
# if [ $# -eq 0 ]; then
|
# if [ $# -eq 0 ]; then
|
||||||
# for i in $(pacman -Qmq); do
|
# for i in $(pacman -Qmq); do
|
||||||
# PKG_LIST=
|
# PKG_LIST=
|
||||||
|
|
|
@ -94,7 +94,8 @@ dirsize ()
|
||||||
|
|
||||||
## Network operations
|
## Network operations
|
||||||
if [ -e "/usr/bin/nmap" ]; then
|
if [ -e "/usr/bin/nmap" ]; then
|
||||||
network-map() {
|
network-map()
|
||||||
|
{
|
||||||
echo "$1"
|
echo "$1"
|
||||||
for SCANIP in $( nmap -sL "$1" | grep -i "\([[:digit:]]\+\.\)\{3,\}[[:digit:]]\+" | awk '{print $5}' ); do
|
for SCANIP in $( nmap -sL "$1" | grep -i "\([[:digit:]]\+\.\)\{3,\}[[:digit:]]\+" | awk '{print $5}' ); do
|
||||||
sudo nmap -oX - -n -sT -T Normal -O -sR -I -F -P0 "$SCANIP"
|
sudo nmap -oX - -n -sT -T Normal -O -sR -I -F -P0 "$SCANIP"
|
||||||
|
@ -145,7 +146,8 @@ netspeed ()
|
||||||
## ... (see 'man 5 proc' for further details)
|
## ... (see 'man 5 proc' for further details)
|
||||||
##
|
##
|
||||||
## Only the first 4 values are interesting here.
|
## Only the first 4 values are interesting here.
|
||||||
cpuusage(){
|
cpuusage()
|
||||||
|
{
|
||||||
local cpuarray
|
local cpuarray
|
||||||
local f1
|
local f1
|
||||||
local f2
|
local f2
|
||||||
|
@ -393,7 +395,8 @@ fi
|
||||||
|
|
||||||
## Extractor -- Useless when using 'atool'.
|
## Extractor -- Useless when using 'atool'.
|
||||||
if [ ! -e "/usr/bin/atool" ]; then
|
if [ ! -e "/usr/bin/atool" ]; then
|
||||||
extract () {
|
extract ()
|
||||||
|
{
|
||||||
if [ -f $1 ] ; then
|
if [ -f $1 ] ; then
|
||||||
case $1 in
|
case $1 in
|
||||||
*.tar.bz2) tar xvjf $1 ;;
|
*.tar.bz2) tar xvjf $1 ;;
|
||||||
|
@ -449,10 +452,10 @@ archive ()
|
||||||
printhelp()
|
printhelp()
|
||||||
{
|
{
|
||||||
echo "Synopsis:"
|
echo "Synopsis:"
|
||||||
echo -e " $1 [-m METHOD] [-v] FILE"
|
echo -e " $1 [-m METHOD] [-v] FILES|FOLDERS"
|
||||||
echo
|
echo
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
echo -e " default:\tDisplay packages included in FILE but not installed."
|
echo -e " default:\tCreate an archive of specified FILES and/or FOLDERS."
|
||||||
echo -e " -h:\t\tDisplay this help."
|
echo -e " -h:\t\tDisplay this help."
|
||||||
echo -e " -m:\t\tChoose compression method."
|
echo -e " -m:\t\tChoose compression method."
|
||||||
echo -e " gz\t\tgzip (default)."
|
echo -e " gz\t\tgzip (default)."
|
||||||
|
@ -507,12 +510,6 @@ archive ()
|
||||||
|
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
echo "Missing argument."
|
|
||||||
echo "Use $0 -h for help."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local ARCPATH
|
local ARCPATH
|
||||||
local ARCSOURCE
|
local ARCSOURCE
|
||||||
local ARCNAME
|
local ARCNAME
|
||||||
|
@ -535,10 +532,13 @@ archive ()
|
||||||
tar -${ARCOPT} -cvf "$ARCNAME" "$ARCSOURCE" ${OPTION_VCS})
|
tar -${ARCOPT} -cvf "$ARCNAME" "$ARCSOURCE" ${OPTION_VCS})
|
||||||
|
|
||||||
else
|
else
|
||||||
local FILELIST=()
|
## Note for zsh: do NOT initialize an array with "myarray=()".
|
||||||
|
local FILELIST
|
||||||
|
|
||||||
for i; do
|
for i; do
|
||||||
FILELIST=(${FILELIST[*]} "$i")
|
FILELIST=(${FILELIST[*]} "$i")
|
||||||
done
|
done
|
||||||
|
|
||||||
tar -${ARCOPT} -cvf "$ARCNAME" ${FILELIST[*]} ${OPTION_VCS}
|
tar -${ARCOPT} -cvf "$ARCNAME" ${FILELIST[*]} ${OPTION_VCS}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -556,7 +556,8 @@ git-compare()
|
||||||
}
|
}
|
||||||
|
|
||||||
## This function will clean TeX/LaTeX project folders recursively.
|
## This function will clean TeX/LaTeX project folders recursively.
|
||||||
texclean () {
|
texclean ()
|
||||||
|
{
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
WORKDIR="$PWD"
|
WORKDIR="$PWD"
|
||||||
else
|
else
|
||||||
|
|
6
.zshrc
6
.zshrc
|
@ -3,12 +3,6 @@
|
||||||
## Date 2012-08-11
|
## Date 2012-08-11
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
##==============================================================================
|
|
||||||
## If not running interactively, don't do anything
|
|
||||||
##==============================================================================
|
|
||||||
## Useless for Zsh ?
|
|
||||||
[ -z "$PS1" ] && return
|
|
||||||
|
|
||||||
##==============================================================================
|
##==============================================================================
|
||||||
## Sourcing
|
## Sourcing
|
||||||
##==============================================================================
|
##==============================================================================
|
||||||
|
|
Loading…
Reference in New Issue