------------------------------One of the shell versions used by Linux is the [Bourne Again Shell] abbreviated to bash. This shell is an enhanced version of the Bourne shell, developed under the GNU architecture.The first popular Shell[bourne
Medium brackets [
and the test command equivalent, the user Boolean judgment, such as:1 a='abc'2if'abc' ] 3 Then 4 " Yes " 5 Else 6 " No " 7 FiEquivalent to1 if ' ABC ' 2 Then 3 " Yes " 4 Else 5 " No " 6 FiWhen using [], be
First shell #!/Bin/bash echo "Hello world!" The "#!" fixed tag is used to specify which interpreter the script uses to parse the script and must have Execute permissions chmod+X./test.sh increased execution permissions./Test.sh executes the script
${STR-NEWSTR} is only replaced when STR is NULL${STR:-NEWSTR} replace when STR is null or if STR is an empty stringAll in all,-number, when STR has no content, then replace,: The number just increases the case of an empty string. Note that the
Some of the details of the shell are not very familiar with, borrowed a lot of other people's Things1. Word Frequency This problem is simple, as long as can be sorted can be cat words.txt |tr-s "" \ n "sort | unique-c | Sort-r | awk ' {print $ ' $ '
--run. SH Job commandSh. sh--let Job run behind stageNohup ./.sh&--met error as below when rub. SH jobError ' XX.sh:line XX:sqlplus:command not found 'Method:source. Bash_profile--delete file,-f (delete directly without remaind)rm-f filename--delete
We use this when sqlplus interacts with the shell.Su-oracle-c "Sqlplus/as sysdbaSELECT * from GV ($instance);ExitEOF "This program does not seem to be a problem, the actual execution of the time will be error.Why?Because in this way, something in
-e filename true if filename exists-d filename If filename is a directory, true-F filename True if filename is a regular file-L filename True if filename is a symbolic link-r filename If filename is readable, true-W filename if filename is writable,
#!/bin/sh for in. /* do if test-d $p then touch $p ". Ok" if test-f $p "/busi.xml" then echo "Delete ${p}/ Busi.xml " rm $p"/busi.xml " fi for Z in $ (Find $p-name" *.zip ") do
Shell scripts are executed in various ways (source./*.sh,. The difference between./*.sh,./*.sh)Original source: http://blog.csdn.net/dance_rise/article/details/8573560Conclusion One: The/*.sh is executed in the same way as sh./*.sh or bash./*.sh,
Basic knowledge before learning shell scripts
Chapter 2 LearningShellBasic knowledge before script
In daily linux system management, shell scripts are indispensable. If you do not write shell scripts, you are not a qualified administrator. At
Linux shell reads the file line by line,Read File lines
For
Command replacement
Code block redirection
While
Pipeline operator
Code block redirection
For
IFS=$'\n'for line in `ls -l`do (( count++ ))doneecho $count
Note:
Frequently used shell commands for updating Mac server services, and mac server shell commands
On the Mac server, you must enable remote logon. Enable: system preference settings-> share check remote LogonCommon Commands include:
Copy (copy the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.