diff options
| author | Jari Aalto <jari.aalto@cante.net> | 2004-07-27 13:29:18 +0000 |
|---|---|---|
| committer | Jari Aalto <jari.aalto@cante.net> | 2009-09-12 16:46:56 +0000 |
| commit | b80f6443b6b7b620c7272664c66ecb0b120a0998 (patch) | |
| tree | 9f71c98d8fe8fa0f41d95e1eb4227f32a09d43ca /examples/scripts | |
| parent | 7117c2d221b2aed4ede8600f6a36b7c1454b4f55 (diff) | |
| download | bash-b80f6443b6b7b620c7272664c66ecb0b120a0998.tar.gz | |
Imported from ../bash-3.0.tar.gz.
Diffstat (limited to 'examples/scripts')
| -rwxr-xr-x | examples/scripts/bcsh.sh | 20 | ||||
| -rw-r--r-- | examples/scripts/fixfiles.bash | 2 | ||||
| -rw-r--r-- | examples/scripts/line-input.bash | 7 |
3 files changed, 14 insertions, 15 deletions
diff --git a/examples/scripts/bcsh.sh b/examples/scripts/bcsh.sh index 509fe885..b810cab8 100755 --- a/examples/scripts/bcsh.sh +++ b/examples/scripts/bcsh.sh @@ -389,7 +389,7 @@ esac trap ':' 2 trap exit 3 -trap "tail -$savehist $histfile>/tmp/hist$$;uniq /tmp/hist$$ > $histfile;\ +trap "tail -n $savehist $histfile>/tmp/hist$$;uniq /tmp/hist$$ > $histfile;\ rm -f /tmp/*$$;exit 0" 15 getcmd=yes @@ -517,7 +517,7 @@ do esac cmd="${cmd};$line" - while test "$line" != "done" -a "$line" != "end" + while test "$line" != "done" && test "$line" != "end" do echo $n "$PS2$c" read line @@ -531,7 +531,7 @@ do echo "$cmd" > /tmp/bcsh$$ ;; if[\ \ ]*) - while test "$line" != "fi" -a "$line" != "endif" + while test "$line" != "fi" && test "$line" != "endif" do echo $n "$PS2$c" read line @@ -659,7 +659,7 @@ esac/ -[0-9]*) wanted="`expr \"$i\" : '-\([0-9][0-9]*\).*'`" rest="`expr \"$i\" : '-[0-9][0-9]*\(.*\)'`" - i="`tail -$wanted $histfile | sed -e "1q"`" + i="`tail -n $wanted $histfile | sed -e "1q"`" ;; esac ;; @@ -917,14 +917,14 @@ esac/ continue ;; exec[\ \ ]*) - tail -$savehist $histfile>/tmp/hist$$ + tail -n $savehist $histfile>/tmp/hist$$ uniq /tmp/hist$$ > $histfile rm -f /tmp/*$$ echo $cmd > /tmp/cmd$$ . /tmp/cmd$$ ;; login[\ \ ]*|newgrp[\ \ ]*) - tail -$savehist $histfile>/tmp/hist$$ + tail -n $savehist $histfile>/tmp/hist$$ uniq /tmp/hist$$ > $histfile rm -f /tmp/*$$ echo $cmd > /tmp/cmd$$ @@ -936,22 +936,22 @@ esac/ # sh $logoutfile $SHELL $logoutfile fi - tail -$savehist $histfile > /tmp/hist$$ + tail -n $savehist $histfile > /tmp/hist$$ uniq /tmp/hist$$ > $histfile rm -f /tmp/*$$ exit 0 ;; h|history) - grep -n . $histfile | tail -$history | sed -e 's@:@ @' | $PAGER + grep -n . $histfile | tail -n $history | sed -e 's@:@ @' | $PAGER continue ;; h[\ \ ]\|*|h[\ \ ]\>*|h\|*|h\>*) - cmd="`echo \"$cmd\" | sed -e \"s@h@grep -n . $histfile | tail -$history | sed -e 's@:@ @'@\"`" + cmd="`echo \"$cmd\" | sed -e \"s@h@grep -n . $histfile | tail -n $history | sed -e 's@:@ @'@\"`" getcmd=no continue ;; history[\ \ ]*\|*|history[\ \ ]*\>*) - cmd="`echo \"$cmd\" | sed -e \"s@history@grep -n . $histfile | tail -$history | sed -e 's@:@ @'@\"`" + cmd="`echo \"$cmd\" | sed -e \"s@history@grep -n . $histfile | tail -n $history | sed -e 's@:@ @'@\"`" getcmd=no continue ;; diff --git a/examples/scripts/fixfiles.bash b/examples/scripts/fixfiles.bash index 67311eed..15f3ba86 100644 --- a/examples/scripts/fixfiles.bash +++ b/examples/scripts/fixfiles.bash @@ -62,7 +62,7 @@ processdir() set +f for file in * ; do set -f - if [ "$file" != "." -a "$file" != ".." ] ; then + if [ "$file" != "." ] && [ "$file" != ".." ] ; then if [ -L "$file" ] ; then echo "skipping symlink" $file in `pwd` elif [ -d "$file" ] ; then diff --git a/examples/scripts/line-input.bash b/examples/scripts/line-input.bash index 02c2bc2c..3f2efaef 100644 --- a/examples/scripts/line-input.bash +++ b/examples/scripts/line-input.bash @@ -125,11 +125,11 @@ function getline unset linesave # forget temp var ;; ) - while [ "${line% }" != "$line" -a ${#line} != 0 ] ; do + while [ "${line% }" != "$line" ] && [ ${#line} != 0 ] ; do echo -n " " line="${line%?}" done - while [ "${line% }" = "$line" -a ${#line} != 0 ] ; do + while [ "${line% }" = "$line" ] && [ ${#line} != 0 ] ; do echo -n " " line="${line%?}" done @@ -151,7 +151,7 @@ function getline # If length is restricted, and the line is too # long, then beep... - if [ "$2" != 0 -a $(( ${#line} >= $2 )) = 1 ] ; then + if [ "$2" != 0 ] && [ $(( ${#line} >= $2 )) = 1 ] ; then echo -n else # Otherwise add line="$line$key" # the character. @@ -182,4 +182,3 @@ getline LINE 50 restore echo "<$LINE>" - |
