Unix Shell Programming Notes series (i)

I. Review of BASIC commandsDate//day and time displayedWHO//view all users logged in to the systemecho//Display the input contentFile Operation classLS//List file listCAT//Display file contentsNumber of words in WC//statistics fileCP//Copy

Base shell Script

#! /bin/shA= "Hello World"echo "A is"Echo $aecho ""echo "A is $a"Results of the output:A isHello WorldA is Hello World2 Getting the system time:Get today's period: ' Date +%y%m%d ' or ' date +%f ' or $ (date +%y%m%d)Get yesterday's period: ' Date-d

HBase Shell Input command does not remove problem resolution tips

First, Introduction:HBase shell using the process, using the CRT client, the command input can not be deleted has been trapped around me, today finally unbearable, a few degrees Niang, Google, finally have a solution, special share to

Shell $! The meaning of $#

The execution name of this program$n the nth parameter value of this program, n=1..9$* all parameters of this program, this option can have more than 9 parameters.$# the number of parameters for this program$$ the PID of this program (the current

Shell scripts pass parameters with spaces [excerpt from network]

parameter Handling Description $# The number of arguments passed to the script $* Displays all parameters passed to the script in a single string $$ The current process ID number for the

Shell theory Study (iii)

37. Adjust the properties of a variable Read-only variable: use the readonly commandReadOnly variable Name ReadOnly Other uses ReadOnly or readonly-p: Displays a list of variables that currently have read-only properties

Shell determines whether the input is valid IP and letter

Tag: Shell Determines whether the input is valid IP shell determines whether the input is a letter1. Purpose of demandRecently in the study of ansible automation tools, in the host table (/etc/ansible/hosts) Add Management node information, a few to

Automatically clears the Date directory shell script

Many times backups usually use a date-based folder to create folders, and for these date folders There are a lot of subfolders, and for these date files are removed all the time, it is a bit of a struggle to combine RM or delete with find. This

Linux timed execution shell script _crontab

1. View tasks [[email protected] oraclebacka]$ crontab-l2. New task [[email protected] oraclebacka]$ CRONTAB-E3, 14 points per day 40 execute/backup/oraclebacka/sh.sh script, log output to/backup/oraclebacka/shlog.txt* * * */backup/oraclebacka/sh.sh

Summary of Shell interception string methods in Linux

There are eight ways to intercept a string, mainly for the following methodsThere are a number of ways to intercept strings in the shell, ${expression} There are 9 ways to use them.

Modify Shell terminal prompt information

The shell terminal only displays the user name, hostname, working directory by default, and sometimes we need to simply tweak the information displayed on the shell terminal to make the work more efficient. For example, we can add time to the shell

[Shell] Shell Learning notes for

There are a lot of uses for the For loop in the shell, and I've been trying to summarize what I saw on the web today about the for loop usage.Knot, feel very comprehensive, so turn around research and research, hey ...1, for ((i=1;i2. Common in

The shell logic of Linux

When the shell executes a command, it returns a return value that is saved in the shell variable $? In When $? = = 0 o'clock, indicating successful execution; = = 1 o'clock, which indicates that the execution failed.' | | 'Left command returns FALSE,

Changing the Linux shell foreground and background colors

Set to white on black backgroundEcho-e "/033[037;40m"Color is selected by adding a dedicated sequence-basically a numeric value sandwiched between "/e[" and "M". If more than one numeric code is specified, separate them with semicolons.Echo-e "/e[31;

Shell for, while usage

#数字段形式For i in {1..10}DoEcho $iDone#详细列出 (characters and not many items)For File in 1 2 3 4 5DoEcho $FileDone#对存在的文件进行循环For shname in ' LS *.sh 'DoName= ' echo ' $shname | Awk-f. ' {print '} 'Echo $nameDone#查找循环 (This method can also be used when

Linux system security Settings shell script

#!/bin/sh# desc:setup Linux system security# powered by Www.lvtao.net#account setuppasswd-L XFSPASSWD-L NEWSPASSWD-L NSCDPASSWD-L DBUSPASSWD-L VCSAPASSWD-L GAMESPASSWD-L NOBODYPASSWD-L AVAHIPASSWD-L HALDAEMONPASSWD-L GOPHERPASSWD-L FTPPASSWD-L

Linux shell switching

If you need to modify the default shell (typically the bash shell), use it handy. Check the shell types available for your system first[email protected] ~]$ chsh-l/bin/sh/bin/bash/sbin/nologin/bin/tcsh/bin/csh/bin/kshModify the current shell[email

Shell script Learning

Shell script Learning1111111111111 clear the simple command script of the messages log file under/var/log/Var/log/the system file under the log file must have the root permission:$ UID is the global variable of the system:Make & make install

Shell exits and returns a summary.

Shell exits and returns a summary. Common Responses in shell: exit, breakm, return Exit: In fact, after each command is executed, an execution state is returned! If the execution is successful, 0 is returned. If the execution limit is not

Shell IFS readLine. sh, ifsreadline. sh

Shell IFS readLine. sh, ifsreadline. sh processLine(){line="$@"echo $line} FILE="" if [ "$1" == "" ]; then FILE="/dev/stdin"else FILE="$1" if [ ! -f $FILE ]; then echo "$FILE : does not exists" exit 1 elif [ ! -r $FILE ];

Total Pages: 541 1 .... 490 491 492 493 494 .... 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.