Linux Learning Notes (24) Pipe and job control, shell variables, environment variable profiles

one, pipe and operation controlCat 1.txt |wc-l; Cat 1.txt |grep ' aaa 'Enter the result of the preceding command to the following commandCTRL Z pauses a task, the task is hidden in the background, and the FG can be used to lift the task to the

Shell exercise (Key-free login script)

#!/bin/bashremote_ip=$1if[!-N" $"] ; Then Echo "Please usage./without_password remote_host!"Exit1Else Echo "The remote_host you input is $remote _ip"fiSSH[Email protected] $remote _IP"mkdir. ssh; chmod. SSH"Ssh-keygen-t RSASCP~/.SSH/id_rsa.pub

Shell Scripting Learning notes-logical operators

1.1 The following table is a logical operatorTips:! Inverse: A logical value that is opposite to a logical value.-A Chinese meaning is with (&&): Two logical values are true return values are true, and vice versa is false.-O Chinese meaning yes or

One-click installation of Nginx and FSFS Distributed file storage shell scripts

#!/bin/bash# lty 20180116# fastdfs install scriptif [  ' Id -u '  -ne  0 ];then    echo  "Non-root user, script exit"     exit 0fiif  [ ! -f  "/root/soft/fastdfs_install.sh"  ];then    echo  " Reinstall the installation script side after

Shell exercises (10)

Exercise 1:User interaction ScriptsRequirements: write a script that, after execution, prints a line that says "Please input a number:", asks the user to enter a value, prints out the value, and then asks the user to enter the value again. Until the

Shell Introduction and command history

1. What is a shell?Open the system, enter ZS, press the Tab key, the command Zsoelim appears,Description No zsh command, this time can be installed, first enter the command yum list |grep zsh, enter, search,You can see that there are zsh commands,

Sylixos Common shell directives

1. Shell command IntroductionThe shell is the user interface of the system and provides an interface for users to interoperate with the kernel. It receives the instruction entered by the user and sends it to the kernel for execution. A shell user

Full-Library cold backup of shell scripts

#!/bin/bashbackup_dir=/oracle/backuplog_file= $ORACLE _base/admin/$ORACLE _sid/cold_backup_$oracle_sid.logecho   "Backuping cold backup"  > $log _filedata>> $log _filesqlplus -s /  As sysdba > $log _fileset pagesize 0 linesize 1000 

Shell scripting Common (1)

\u indicates that the current user name \h represents the machine name \w represents the base name of the current working directory \w represents the full path to the current working directory. $, $, $, $: $ The name of this shell file refers to the

One shell per day (vii) IP and PV for the statistics site

Using Nginx log file to count all IP and PV, list the top 10 IP, take confluence Knowledge base system as an example:Nginx log file is/var/log/nginx/access.log# wc -l /var/log/nginx/access.log 95146 /var/log/nginx/access.logShell script:# vim

Linux Shell shortcut keys

CommonCtrl+r: Quick Search History Command (Retrieve)Ctrl+u: Delete entire command line text character (Unity)Ctrl+s: Pausing a Running program (STOP)Ctrl+q: Exit Pause (quit)CTRL + Z: Enables tasks that are running in the terminal, running in the

Shell Process Control Statements

First, ifSyntax format: If test-d $arg then ... else ... fiVariable test statements can be simplified with []. Example: test-d $arg equivalent to [-D $arg]. (Note: "Space" ["Space"-D "space"])For more test commands see: http://www.cnblogs.com/fangwu/

Shell Programming _ Implement Recycle Bin, avoid accidental deletion of files

The code is as follows:Download: Https://gitee.com/LoongWang/shellrecycling.git1#/usr/bin/EnvBash2 3 4 #定义5 #定义回收站目录6Recyclingdir='/usr/local/recycling/'7 #定义回收站log文件8recyclinglog='/var/log/recyclinglog'9

Shell Script Basics (i)

With the more and more application of Linux system in enterprise, the automatic management of server becomes more and more important, in some complex Linux maintenance work, a lot of repetitive output and interactive operation are not only time

Shell Script 100 Example "II"

11. Scripting, man-machine Games#!/bin/bash#Author: The Adventures of Tintin (Jacob)Game= (Stone scissors cloth)NUM=$[RANDOM%3]computer=${game[$num]}#通过随机数获取计算机的出拳#出拳的可能性保存在一个数组中, game[0],game[1],game[2] are different possibilities in 3,

Shell basic Syntax (ii)

If statementBasic formatFormat 1:if condition; Then statement; FiFormat 2:if condition; Then statement; else statement; FiFormat 3:if ...; Then ...; Elif ...; Then ...; else ...; Fican use && | | Combine multiple conditionsIf [$a-gt 5] && [$a-lt 10];

Shell Scripting App (shell scripting Basics vs. Shell variables)

1. Shell: Command interpreter1) supported shells are saved in/etc/shells2) Default shell is/bin/bash2. Shell script writing:1) using the VI Editor2) One command per line, followed by3) Give executable permissions (x)3, the way of implementation:1)

Shell Script Note (iii) mathematical calculations in the shell

Mathematical calculations in the shellOne, use square brackets#!/bin/Basha=tenb=c=res=$[$a * ($c-$b)] Echo $resIi. usage of BCBC Technology is actually a programming language that recognizes: numbers (integers and floating-point numbers)

Shell scripts automatically deploy Springboot apps

The company project used Springboot. Applications that are developed need to be automatically uploaded to the server. Although the current thermal deployment is not fully mastered. First use the shell to simplify deployment.# upload Key Sshloginkey=/

Use of the special variable IFS in shell and its value is $ & #039; \ n & #039; and & #039 ;\\ n & #039, shellifs

Use of the special variable IFS in shell, and the difference between the value of $ '\ n' and' \ n', shellifs When a for loop is used in shell, the IFS is also used to define the separator. To specify multiple IFS characters, you only need to

Total Pages: 541 1 .... 281 282 283 284 285 .... 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.