Shell file expression

file Expression-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

Experimental three---shell programming

In addition to being an interpreter, the shell is a high-level programming language with variables, keywords, and a variety of control statements.Command historyHistory displays a list of historical commands, including its ownHistory 50 shows the

Linux Shell Programming (eight): Looping structure

Looping statementsThe looping statements in the shell are as follows: for while unitl case select For/while/unitl must end with done forCycleforLoops are used to iterate through an array (data list) or

Exception handling, module package, Time module, subprocess (Invoke shell command)

Exception handlingYou can use the Try/except statement to catch an exception.The try/except statement is used to detect errors in a try statement block, allowing the except statement to catch exception information and handle it.If you do not want to

Shell Scripting Basics (eight)

One, expect script synchronization file[[email protected] ~]# cd /usr/local/sbin/[[email protected] sbin]# ls01.expect 02.expect 03.expect check_ng.sh lvs_dr.sh lvs_nat.sh mon nginx_log_rotate.sh[[email protected] sbin]# vim 04.expect

Basic Shell Command 2

2. process file 2.1 Create file TouchIf you want to change the access time only, you can use the-a parameter.$ ls-l Test_one-rw-rw-r--1 Christine Christine 0 may 14:35 Test_one$ touch-a Test_one$ ls-l Test_one-rw-rw-r--1 Christine Christine 0 may 14:

Pipe and job control, shell variables, environment variable profiles

One, pipe and operation control1. Pipe character: | (The result of the previous command output to the following command)Count the number of files after the ls command: LS |wc-lList the number of files in the/etc/directory: find/etc/-type f |wc-l2.

(reproduced) Shell script exercises

#!/bin/bash #Write a script#1. Set the value of the variable file to/etc/passwd#2. Say hello to each user in/etc/passwd and say what the ID is.#shaped like:#Hello,root,your UID is 0. FILE=/etc/passwd COUNT= ' Wc-l${file}| Cut-f1-d" "` forIinch'

Shell Logic judgment

Format 1:if condition; Then statement; FiFormat 2:if condition; Then statement; else statement; FiFormat 3:if ...; Then ...; Elif ...; Then ...; else ...; FiLogical judgment expression: if [$a-gt $b]; If [$a-lt 5]; If [$b-eq 10] et-gt (>); -lt (=); -

Shell file lookup and compression commands

Locate command1.locate filenameFuzzy match as long as the file name contains the keyword can beNon-real-time lookup, faster than find.Rely on index database/var/lib/mlocate/mlocate.dbAutomatically run once a day to update the database.UpdateDB

Shell Introduction, Date command, Shell variable

What is Shellshell? Shell is a scripting languagecan use logical judgment, circular judgment and other statements;functions can be customized;A shell is a collection of system commands, such as a batch command of Windows;Shell script can

Use of case in shell scripts

The case selection statement in the shell script can be combined with the read instruction to achieve a good interactive response operation, case receives one or more parameters passed in by the read instruction, and then the case is selected

Shell Variable Introduction

Variable naming rules变量名必须以字母或下划线开头,名字中间只能由字母,数字和下划线组成,大小写是区分的变量名的长度不得超过255个字符变量名在有效的范围内必须是唯一的在Bash中,变量的默认类型都是字符串类型"用户自定义变量" ? ?变量自定义的"环境变量" ? ?这种变量中主要保存的是和操作环境相关的数据。变量可以自定义,但是对系统生效的环境变量名和变量作用是固定的。"位置参数变量" ? ?

Shell Process Control Statements

Case statementcase $变量名 in "值1") ? 如果变量的值等于值1,则执行程序1 ;; ?"值2") ? 如果变量的值等于值2,则执行程序2 ;; ? ...省略其他分支... ? *) ? 如果变量的值都不是以上的值,则执行此程序 ;;esac ?//case反过来写"case语句的使用实例"#!/bin/bashread "please input yes /no": chocase "$cho" in "yes") ? ? echo "输入正确!";; ?"no"

[Shell] Swoole_timer_tick and crontab for scheduled tasks and monitoring

There are three main steps to completing tasks and monitoring manually:1. mission_cron.php (timed automatic task script):2. Mission_cron_monitor (run by crontab, monitor the above script):#/bin/bash# Monitor the timer and disconnect the reboot. # #

Shell's service anomaly monitoring case

Example one: Web server Nginx Script service monitoring[Email protected]/server/scripts] #cat jiance_ng.sh#!/bin/bashif! Ss-lntup|grep [N]ginx &>/dev/nullThen/etc/init.d/nginx startecho "Nginx dead,but It's OK" |mail-s "WHW11" [email

cannot be deleted after entering with hbase shell in Xshell

The issue cannot be removed after using HBase shell entry in Xshell:In the HBase shell, the wrong input instructions can not be deleted using backspace and delete, the use of the people know that this is a lot of pits, there is much distress!OK,

Explanation of Bash Shell terminal in Linux

Shell: is an outer layer of the kernel Protection tool, and is responsible for the completion of user-to-kernel interaction;Provides an interface for users to interact with the kernel, which receives commands entered by the user and sends it to the

Rote memorization in the shell

One, the shell quotes1. "", double quotation marks (do not retain the full content, such as encountered $, anti-quotes, \ etc will execute the corresponding shell)echo "Today is `date`" -> Today is Wed Aug 2. Single quotation mark (full retention

Shell scripts to install the NTP Server service

############################# #Deploy NTP server ########################Echo "start deploy NTP server" Yum Install-y NTPif[!-f/var/log/ntpd.log]; Then Touch/var/log/Ntpd.logfi Chownntp:ntp/var/log/Ntpd.logCat$basepath/package/ntp.conf

Total Pages: 541 1 .... 341 342 343 344 345 .... 541 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.