Since the first written blog (on the Blue Bridge Cup), and a week later, had planned to be at least one week to write a blog to write down their own progress in a week of (learning), and thus facilitate their future Recalling the study, but in the end he is still delayed all kinds of things that he sometimes just do not want to learn a whole, do not want to go and get this, I feel typesetting, typing, looking particularly troublesome time-consuming material, preferring to sit and do not want to go and get, to no longer time dragged on, it is going to get this up, and sometimes found the whole thing was not particularly troublesome, but lack the courage to try, do not bother their own imagination, it is not going to get the results of their own time to do it personally, but also found not so much trouble, but do it very feeling that their own progress, and talked a lot of nonsense, in short, life or must have the courage to try, so will have their own progress .
By the way, I saw a share of the day's program, including learning to relax and feel good;
2.shell learning program
echo
Similar to the C language printf, it is what the printed output.
zgq@123:~$ echo"you are a lovely girl!"
you are a lovely girl!##直接在终端就输出.
If you want to output the value of variables, of course, certainly also possible, for in printf you can know.
Of course, if you want to direct output date, also possible, in its default format, the only note is that when the output variables need to add the "&" symbol .
This is in direct output terminal command, of course, can also create shell command file, and then set the file permissions, and then run it.
#!/bin/shecho"Mr.$USER,Today is:"echo`date"+%B%d%A"`echo"wish you a lucky day!"
## 然后设置文件权限,用到chmod指令,设置该文件 可读可写可操作,然后运行该shell文件,即可得到运行结果。
zgq@123:~~/bin$ chmod 700 FirstShell
zgq@123:~/bin$ ./FirstShell
Mr.zgq,Today is:
四月08星期一
wish you a lucky day!
About chmod command may be said here about the usage of chmod [ABC] file or directory a, b, c, representing the user, group, other permissions and r = 4, w = 2, x = 1, the representative read , write, execute permissions, 0 is not the authority. For example chmod 666 FirstShell bash provided the file user, group, other permissions are read and write, but can not operate.
if the judge sentences, the main difference is the way of judgment, -r expressed as true, -d represents the directory is true and so on.
#! /bin/bashecho"Please enter the directory name of file name"readddif[ -r $dd]thenls$ddelseecho"input error"fi
zgq@123:~/bin$ chmod 700 shell212
zgq@123:~/bin$ ./shell212
Please enter the directory name of file name
ZGQ ##输入文件夹名称,并且可读
Add.c Add.o hello.h Makefile print.h test test.o ##列出文件夹下的名称
Add.h hello.c hello.o print.c print.o test.c
for the C language for use in a similar, the following function to calculate a 1-1 / 2 + 1 / 3-1 / 4 + 1 / 5- ... - / + 1 / n, n input by the user