In the afternoon, when writing a program, you need to assign the value returned by the shell command to a variable, using the a=$ () method
soft=$ (grep-i "\ Software \) token/passcode/." 123.txt |wc-l)
echo "[+] Soft card total:" $soft
......
The
Objective
Many commands are executed simultaneously during Linux operations or during day-to-day Linux operation, so that it needs to be handled through our multiple command methods. Multi-order execution includes '; ' And the ' && ' command so
Part 1: ' Command '
This is the "command standard output as a function of standard input" method of operation, there are great drawbacks and unsafe places.
disadvantage one: relatively old.
disadvantage two: easy to confuse with single quotes.
This is the 8th/101 script
There are as many ways to solve this quirky echo problem as There are the pages in this book. One of my favorites is very succinct:
function Echon
{
echo ' $* ' | awk ' {printf '%s ' $} '
}
You could prefer to
Special folder names are used to index the collection to retrieve the special folders that are required, and the following special folders are listed in the document:
How to calculate the number of files and directories in the current directory
# ls-l * |grep "^-" |wc-l----to count files
# ls-l * |grep ' ^d ' |wc-l-----to Count dir
How do I just column subdirectories?
Ls-f | grep/$
Simple Google a bit, not fruit, so sent an email for advice, and soon have a reply.
Copy Code code as follows:
Path = "C:\test.jpg"
arr = Split (Path, "\")
FileName = arr (Ubound (arr))
FolderPath = Left (path, Len (path)-Len (FileName)-
A shell script that backs up a database
Copy Code code as follows:
#!/bin/bash
#指定运行的脚本shell
#运行脚本要给用户执行权限
Bakdir=/backup
Month= ' Date +%m '
day= ' Date +%d '
Year= ' Date +%y '
Hour= ' Date +%k '
min= ' Date +%m '
Take a look at the contents of the original file:
Copy Code code as follows:
Root@localhost ~]# Cat File.txt
Hello World
A:b:c-h-N
A:b:c-h-N
SED deletes related rows based on conditions:
Copy Code code as follows:
Sign up for a system service to boot from.
1 Script Authoring
#vim test.sh
Copy Code code as follows:
#!/bin/bash
#description: hello.sh
#chkconfig: 2345 20 81
exec_path=/usr/local/
exec=hello.sh
daemon=/usr/local/hello.sh
$#: Number of parameters passed to script$*: Displays all parameters passed to the script in a single string. Unlike positional variables, this option argument can exceed 9$$: The current process ID number of the script run$! : The process ID number
Linux shell script detects tomcat and restarts automatically
Background Run command sh xxx.sh &View background tasks: JobsSummoned to the front desk: FG Jobs number
The code that can delete the while loop is put into the crontab, and the script
Recently in the debugging server iptables, oneself made a timed turn off iptables, but at night home rarely open a computer, so can not go to start iptables, of course, you may say, why not cancel timed shutdown iptables, I can only say that
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service