] opt]# grep root passwd*Passwd:root:x:0:0:root:/root:/bin/bashPasswd:operator:x:11:0:operator:/root:/sbin/nologinPasswd1:root:x:0:0:root:/root:/bin/bashPasswd1:operator:x:11:0:operator:/root:/sbin/nologin[Email protected] opt]#8. Display the line number of the grep result[Email protected] opt]# grep root-n passwd1:root:x:0:0:root:/root:/bin/bash11:operator:x:11:0:operator:/root:/sbin/nologin[Email protected] opt]#9. Display file names that contain characters[Email protected] opt]# grep root-l p
The remaining space is Morethan the%, the message is sent to the Wl#tue2 the: $: AboutCst .PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/wl/Binexport PATH forRemainingspaceinch$(DF-H |awk '{print $}'|grep-V' Use'|sed-E's/[%]//g') Do if[[$RemainingSpace > the]]; Then Echo-E"$RemainingSpace" Echo-E"$ (df-h | grep $RemainingSpace)">/service/script/. Harddiskwarning Mail-S"Disk Warning"WL . Harddiskwarningfi Done4. Detecting remaining Inode#!/bin/
Tags: background color Unzip replacement node Compression tool tip really options sageOne, the basic Bash Shell command 1, the default bash shell prompt is the dollar sign ($); 2. The Bash manual uses the man command to access the manual pages stored on the Linux system, suc
" second question #!/bin/bash Declare-i a=$1 While [$a-ne 0] DoEcho-n "$ (($a%10))"A= $a/10DoneEchoThird questionThe script is named backupdaily.shAdd a line to the/etc/crontab0 2 * * * Root ~/backup/backupdaily.sh#!/bin/bashday= ' Date +%y%m%d 'Tar-czf ~/backup/"$day". tar.gz ~/anydirecho "$day: Tar-czf ~/backup/$day. tar.gz ~/anydir" >> ~/backup/backuplogQuestion FourthNot used before, tried, manpage in the few parameters#例如提示 "message" lasts fo
legitimate, determine whether the user name is already present, if present, and then determine whether the user has set a password, if set password, direct exit, not set, the password is set to the specified password after the correct output mode display " Username Password has been updated after exiting "(5) when the user name does not exist, the user is created and the specified password is set for the user to display the" user username created and updated password "(6) requires that no other
only numbers, letters, or underscores, and cannot start with a number3, as far as possible to see the name of the ideaVI. Bash configuration files1. Profileclass : Provides configuration for the interactive login shell process.• Valid profiles for all users are globally valid:/etc/profile and/etc/profile.d/*.sh• Only the profile that is valid for the current user is valid for the user: ~/bash_profileNote:
Tags: shell multi-line redirection1. What is the problem requirement?First, the need to come from, mainly to write shell script, with cat for multi-line input redirection, the Terminator must be hyphenation first, the format is not good-looking.2, how? How to solve this problem?First Baidu, Google search the next, the result is to say that more is the shell multi
${array_var[*]} Outputs all values, echo ${array_var[2]} outputs the second value.7, obtain the terminal information. Gets the number of rows and columns of the terminal: Tput colsTput linesCursor movement understand the position (100,100) at: Tput Cup 100 100Acquisition Time: Date with the following format:$ date "+%d%B%Y"2015 February8, script debugging.Using option-X, start the trace debug shell script:$ bash
Follow the Runoob website tutorial to learn the notesLike other languages, the shell can also contain external scripts. This makes it easy to encapsulate some common code as a standalone file. Shell files contain syntax in two forms
. FileName #也就是一个英文句号后面跟着想要包含的文件名, notice that there is a space separating the middle
SOURCE filename
While experi
Recent project requirements, need to write some shell script interaction, the pipeline is not enough time, expect can be very good to implement the interaction between the script, search for information, found that many articles on the Web are reproduced, I think this article is also good, so simple changes to take over and share with you ~1. Expect isSpawn: Add the shell commands you need to execute, such
Tags: linux operations computer network Dahne Red Hat Linux system operationShell ScriptScript: Can execute the file, after running can implement some function (command stack, non-interactive)Standardize the general composition of shell scripts#! Environmental Statement (Sha-bang)# comment TextExecutable code#! /bin/bash #环境声明 that the script written by Bash is a
shell scripting Introduction and common Tools
Shell Script
Shell script: is actually a batch script in Windows, multiple shell command collections that can be executed at once. Scripts on Linux can be implemented in a number of languages, and the
Purpose: Self-collation, self-review, self-reflection!Content: Dry Goods! Dry!! Dry!!!Attach: The shortcomings of the hope that you correct, can give like me rookie a little inspiration is the best. Just the inspiration ...Thank you: Thank the old boy (see your blog post and video, O (∩_∩) o haha ~), of course, there are online technology Daniel, reference book "UNIX Shell"Bash
????????echo?"$username?已经登录"????????echo?"fuck?,go?out?my?system"?|?write?$username????else????????echo?"$username?已经下线"????fi????sleep?3done}21, randomly generated within 10 of the number, to achieve the word guessing game, the hint is relatively large or small, equal to exit#!bin/bashlim=10let?key=$RANDOM%limread?-p??"please?input?a?number?less?than?$lim:?"?numuntil?false;do????if?[?$num?-le?$lim?>?/dev/null??]??[?$num?-ge?0??>?/dev/null?]?;then????????if?[?$num?-lt?$key?];then????????????rea
Bash Shell Basic features three (array)One, the array definitionAn array is a contiguous number of independent memory spaces, each of which corresponds to a variable. The bash shell supports only one-dimensional arrays, but there is no limit to the number of arguments.Array elements: Array name + index (numbering start
' #将匹配行输出到文件
Sed '/root/r abc.txt '/etc/passwd #把abc. txt file contents after reading into the root matching line
Sed-n '/root/w a.txt '
Sed-n '/root/{=;p} '/etc/passwd #打印行号和匹配root的行
Sed-n '/root/{n;d} '/etc/passwd #将匹配root行的下一行删除
Sed-n '/root/{n;d} '/etc/passwd #将匹配root行和下一行都删除
Sed ' 22{h;d};23,33{h;d};44g ' pass
Vii. sed Script Writing method1. Read the command from the file[Plain]View Plaincopy
Sed-f sed.sh
sed.sh File
Tags: operations shell scripting frequent access to the Internet part of the mutual summaryIn daily work, the bash shell has a very frequent time operation. For example, when the shell script sends statistics periodically, it will check whether the scheduled send time is cur
are currently using[Email protected] conf]# echo $BASH/bin/bash2 script +x to debug, troubleshoot errors[[email protected] sh]#/bin/bash-x variable.sh + hellovariable.sh: line 2:hello: Command not found + a=123+ echo ' Print variables equal I S 123 ' Print variables equal is 1233-E \ n line breakEcho-e "Start scripts. \ n .... "4-E \033[32m \033[0m Promise color [32m can be changed to 33/34/35/36 color]Ech
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.