aboutsummaryrefslogtreecommitdiffstats
path: root/examples/scripts/line-input.bash
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>2004-07-27 13:29:18 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:56 +0000
commitb80f6443b6b7b620c7272664c66ecb0b120a0998 (patch)
tree9f71c98d8fe8fa0f41d95e1eb4227f32a09d43ca /examples/scripts/line-input.bash
parent7117c2d221b2aed4ede8600f6a36b7c1454b4f55 (diff)
downloadandroid_external_bash-b80f6443b6b7b620c7272664c66ecb0b120a0998.tar.gz
android_external_bash-b80f6443b6b7b620c7272664c66ecb0b120a0998.tar.bz2
android_external_bash-b80f6443b6b7b620c7272664c66ecb0b120a0998.zip
Imported from ../bash-3.0.tar.gz.
Diffstat (limited to 'examples/scripts/line-input.bash')
-rw-r--r--examples/scripts/line-input.bash7
1 files changed, 3 insertions, 4 deletions
diff --git a/examples/scripts/line-input.bash b/examples/scripts/line-input.bash
index 02c2bc2..3f2efae 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>"
-