bash for循环打印下面这句话中字母数不大于6的单词。
Bash also interprets a number of multi-character options.
答案:
{{{密码回复可见}}}
Bash also interprets a number of multi-character options.
答案:
{{{密码回复可见}}}
0
#!/bin/bash
##for循环
##王成越
a="Bash also interprets a number of multi-character options."
for i in $a;do
tmp=`expr length $i`
if [ $tmp -le 6 ] ;then
echo $i
fi
done
##for循环
##王成越
a="Bash also interprets a number of multi-character options."
for i in $a;do
tmp=`expr length $i`
if [ $tmp -le 6 ] ;then
echo $i
fi
done
0
#!/bin/bash
a="Bash also interprets a number of multi-character options."
for i in `seq 1 8`
do
word=`echo $a|cut -d ' ' -f$i`
length=`echo $word|wc -c`
[ $length -le 7 ] && echo $word
done
#!/bin/bash
a="Bash also interprets a number of multi-character options."
for i in `seq 1 8`
do
word=`echo $a|cut -d ' ' -f$i`
length=`echo $word|wc -c`
[ $length -le 7 ] && echo $word
done
0
#!/bin/bash
#written by dwt at 2016-06-23
#Bash also interprets a number of multi-character options.
for i in Bash also interprets a number of multi-character options.
do
wnum=`echo $i |wc -L`
if [ $wnum -lt 6 ]
then
echo $i
fi
done
#!/bin/bash
#written by dwt at 2016-06-23
#Bash also interprets a number of multi-character options.
for i in Bash also interprets a number of multi-character options.
do
wnum=`echo $i |wc -L`
if [ $wnum -lt 6 ]
then
echo $i
fi
done
0
#!/bin/bash
array=(Bash also interprets a number of multi-character options)
for ((i=0;i<=${#array};i++))
do
g=${array}
if [ "${#g}" -le 6 ]
then
echo ${array}
fi
done
array=(Bash also interprets a number of multi-character options)
for ((i=0;i<=${#array
do
g=${array}
if [ "${#g}" -le 6 ]
then
echo ${array}
fi
done
0
- for i in `echo "Baoh also interprets a number of multi-character options"`; do
- a=`echo $i| wc -c`
- if [ $a -le 7 ]; then
- echo $i
- fi
- done
0
#!/bin/bash
for i in Bash also interprets a number of multi-character options
do
n=`echo $i|wc -m`
if [ $n -le 7 ]
then
echo $i
fi
done
for i in Bash also interprets a number of multi-character options
do
n=`echo $i|wc -m`
if [ $n -le 7 ]
then
echo $i
fi
done
0
#!/bin/bash
#Description: This script is to calculate words that less than 6 characters.
#Author: Jiazhi Yang
#Date: 16/11/2016
#Script Name: forexample.sh
for i in Bash also interprets a number of multi-character options
do
##百度了一下:-c,--bytes 打印字节数; -m,--character 打印字符数; -l,--lines 打印行数; -w,--words 打印单词数
n=`echo $i |wc -m`
if [ $n -lt 6 ]; then
echo $i
fi
done
0
#/bin/bash
#for循环打印下面这句话中字母数不大于6的单词。
for i in Bash also interprets a number of multi-character options
do
n=`echo $i | wc -c `
if [ $n -le 6 ]
then
echo $i
fi
done
0
#!/bin/bash/for i in Bash also interprets a number of multi-character options. do word=`echo $i |wc -m` if [ $word -le 7 ] then echo $i fidone
0
for b in Bash also interprets a number of multi-character options.
6 do
7 l=`echo $b|wc -m`
8 if [ $l -lt 7 ]
9 then
10 echo $b
11 fi
12 done
编辑回复