Browse Source

Исправлены ошибки использования if [ ... ]

master
Maxim Likhachev 20 years ago
parent
commit
6205cedebf
  1. 2
      etc/shell/bash/aliases
  2. 28
      etc/shell/bash/bash_completion
  3. 10
      etc/shell/bash/bashrc

2
etc/shell/bash/aliases

@ -1,6 +1,6 @@
#!/bin/bash #################################################################### #!/bin/bash ####################################################################
# #
# Изменён: Сб 07 сен 2013 14:03:57 # Изменён: Вск 01 Янв 2006 20:31:28
# #
################################################################################ ################################################################################
#{{{ Псевдонимы #{{{ Псевдонимы

28
etc/shell/bash/bash_completion

@ -194,7 +194,7 @@ _filedir()
#glob=$(set +o|grep noglob) # save glob setting. #glob=$(set +o|grep noglob) # save glob setting.
#set -f # disable pathname expansion (globbing) #set -f # disable pathname expansion (globbing)
if [ "${1:-}" = -d ]; then if [[ "${1:-}" = -d ]]; then
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -d -- $cur ) ) COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -d -- $cur ) )
#eval "$glob" # restore glob setting. #eval "$glob" # restore glob setting.
return 0 return 0
@ -256,9 +256,9 @@ _available_interfaces()
{ {
local cmd local cmd
if [ "${1:-}" = -w ]; then if [[ "${1:-}" = -w ]]; then
cmd="iwconfig" cmd="iwconfig"
elif [ "${1:-}" = -a ]; then elif [[ "${1:-}" = -a ]]; then
cmd="ifconfig" cmd="ifconfig"
else else
cmd="ifconfig -a" cmd="ifconfig -a"
@ -272,7 +272,7 @@ _available_interfaces()
# #
_expand() _expand()
{ {
[ "$cur" != "${cur%\\}" ] && cur="$cur\\" [[ "$cur" != "${cur%\\}" ]] && cur="$cur\\"
# expand ~username type directory specifications # expand ~username type directory specifications
if [[ "$cur" == \~*/* ]]; then if [[ "$cur" == \~*/* ]]; then
@ -455,7 +455,7 @@ _function()
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [[ $1 == @(declare|typeset) ]]; then if [[ $1 == @(declare|typeset) ]]; then
if [ "$prev" = -f ]; then if [[ "$prev" = -f ]]; then
COMPREPLY=( $( compgen -A function -- $cur ) ) COMPREPLY=( $( compgen -A function -- $cur ) )
elif [[ "$cur" == -* ]]; then elif [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- \ COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- \
@ -527,7 +527,7 @@ complete -F _complete complete
# start of section containing completion functions for external programs # start of section containing completion functions for external programs
# a little help for FreeBSD ports users # a little help for FreeBSD ports users
[ $UNAME = FreeBSD ] && complete -W 'index search fetch fetch-list \ [[ $UNAME = FreeBSD ]] && complete -W 'index search fetch fetch-list \
extract patch configure build install reinstall \ extract patch configure build install reinstall \
deinstall clean clean-depends kernel buildworld' make deinstall clean clean-depends kernel buildworld' make
@ -717,8 +717,8 @@ _insmod()
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
# behave like lsmod for modprobe -r # behave like lsmod for modprobe -r
if [ $1 = "modprobe" ] && if [[ $1 = "modprobe" ]] &&
[ "${COMP_WORDS[1]}" = "-r" ]; then [[ "${COMP_WORDS[1]}" = "-r" ]]; then
COMPREPLY=( $( /sbin/lsmod | \ COMPREPLY=( $( /sbin/lsmod | \
awk '{if (NR != 1 && $1 ~ /^'$cur'/) print $1}' ) ) awk '{if (NR != 1 && $1 ~ /^'$cur'/) print $1}' ) )
return 0 return 0
@ -748,8 +748,8 @@ complete -F _insmod $filenames insmod modprobe modinfo
# man(1) completion # man(1) completion
# #
[ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Darwin \ [ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Darwin \
-o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \ -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \
-o $UNAME = OpenBSD ] && -o $UNAME = OpenBSD ] &&
_man() _man()
{ {
local cur prev sect manpath UNAME local cur prev sect manpath UNAME
@ -993,8 +993,8 @@ _find()
-noleaf -version -xdev ' -noleaf -version -xdev '
COMPREPLY=( $( echo "${COMP_WORDS[@]}" | \ COMPREPLY=( $( echo "${COMP_WORDS[@]}" | \
(while read -d ' ' i; do (while read -d ' ' i; do
[ "$i" == "" ] || [[ "$i" == "" ]] ||
[ "${onlyonce/ ${i%% *} / }" == "$onlyonce" ] && [[ "${onlyonce/ ${i%% *} / }" == "$onlyonce" ]] &&
continue continue
# flatten array with spaces on either side, # flatten array with spaces on either side,
# otherwise we cannot grep on word boundaries of # otherwise we cannot grep on word boundaries of
@ -2338,7 +2338,7 @@ _chsh()
cur=${COMP_WORDS[COMP_CWORD]} cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]} prev=${COMP_WORDS[COMP_CWORD-1]}
if [ "$prev" = "-s" ]; then if [[ "$prev" = "-s" ]]; then
if [ -f /etc/debian_version ]; then if [ -f /etc/debian_version ]; then
COMPREPLY=( $( </etc/shells ) ) COMPREPLY=( $( </etc/shells ) )
else else
@ -9283,7 +9283,7 @@ if [ -d $BASH_COMPLETION_DIR -a -r $BASH_COMPLETION_DIR -a \
-x $BASH_COMPLETION_DIR ]; then -x $BASH_COMPLETION_DIR ]; then
for i in $BASH_COMPLETION_DIR/*; do for i in $BASH_COMPLETION_DIR/*; do
[[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|.rpm*) ]] && [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|.rpm*) ]] &&
[ \( -f $i -o -h $i \) -a -r $i ] && . $i [ \( -f $i -o -h $i \) -a -r $i ] && . $i 2>&-
done done
fi fi
unset i unset i

10
etc/shell/bash/bashrc

@ -1,6 +1,6 @@
#!/bin/bash #################################################################### #!/bin/bash ####################################################################
# #
# Изменён: Вс 08 сен 2013 22:24:12 # Изменён: Вск 01 Янв 2006 20:31:43
# #
################################################################################ ################################################################################
@ -61,8 +61,6 @@ if [[ $OS != Windows* ]]; then
export C_INCLUDE_PATH=/usr/libexec/gcc/i486-slackware-linux/$GCCV/:/usr/lib/gcc/i486-slackware-linux/$GCCV/include-fixed/:/usr/lib/gcc/i486-slackware-linux/$GCCV/include export C_INCLUDE_PATH=/usr/libexec/gcc/i486-slackware-linux/$GCCV/:/usr/lib/gcc/i486-slackware-linux/$GCCV/include-fixed/:/usr/lib/gcc/i486-slackware-linux/$GCCV/include
export CPLUS_INCLUDE_PATH=/usr/lib/gcc/i486-slackware-linux/$GCCV/include-fixed/ export CPLUS_INCLUDE_PATH=/usr/lib/gcc/i486-slackware-linux/$GCCV/include-fixed/
export LD_LIBRARY_PATH=/usr/libexec/gcc/i486-slackware-linux/$GCCV/ export LD_LIBRARY_PATH=/usr/libexec/gcc/i486-slackware-linux/$GCCV/
OOoPath="$HOME/Programs/Soft/OOo/openoffice.org3/program/"
fi fi
#Формат времени, выводимый командой time #Формат времени, выводимый командой time
@ -139,7 +137,7 @@ path-- () {
local i local i
for i in ${!2}; do for i in ${!2}; do
if [ "$i" != "$1" ]; then if [[ "$i" != "$1" ]]; then
newpath=${newpath:+$newpath:}$i newpath=${newpath:+$newpath:}$i
fi fi
done done
@ -153,7 +151,7 @@ path++ () {
local i local i
for i in $1; do for i in $1; do
if [ -d "$i" ]; then if [[ -d "$i" ]]; then
if [ -z "${!2:-}" ]; then if [ -z "${!2:-}" ]; then
export $2="" export $2=""
fi fi
@ -192,8 +190,6 @@ if [ $UID -eq 0 ]; then
path++ /usr/sbin PATH path++ /usr/sbin PATH
path++ /usr/local/sbin PATH path++ /usr/local/sbin PATH
else else
path++ $OOoPath PATH
PROMPT_COLOR='\033[1;32m' PROMPT_COLOR='\033[1;32m'
export HOME=/home/$(whoami) export HOME=/home/$(whoami)
fi fi

Loading…
Cancel
Save