Flask接口签名sign原理与实例代码浅析
304
2022-09-24
shell 脚本实现乘法口诀表的两种方法——shell与C语言(shell编程)
shell 脚本实现乘法口诀表的两种方法——shell与C语言
话不多说直接给出代码(执行c语言时没有gcc编译器会报错的哦!):
1 #!/bin/bash
2 if [ $# -eq 0 ]
3 then
4 echo "welcome you!"
5 echo "this is a test with 2 methods to output arbitrarily mux table!"
6 else
7 echo "sorry you input invliad argc!"
8 echo "you input other argc before!"
9 exit 0
10 fi
11
12 while ((1))
13 do
14 echo "you can choose 'shell' 'gcc' or 'quit' command"
15 read -p "please input your choice:" choice
16
17 if [ $choice == "shell" ]
18 then
19 echo "will do show shell"
20 read -p "please input a num you want:" num
21 touch 6.sh
22 echo "" > 6.sh
23 echo '#!/bin/bash
24 for ((j=1;j<=$1;j++))
25 do
26 for((i=1;i<=j;i++))
27 do
28 echo -ne "$i*$j=$[$i*$j]\t"
29 done
30 echo -e "\r"
31 done
32 ' >> 6.sh
33 chmod 777 6.sh
34 cat 6.sh
35 source 6.sh $num
36 exit 0
37 elif [ $choice == "gcc" ]
38 then
39 echo "will do show c"
40 touch 6.c
41 echo "" > 6.c
42 echo '#include
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~