learning bash shell

Discover learning bash shell, include the articles, news, trends, analysis and practical advice about learning bash shell on alibabacloud.com

An alias error in the bash configuration file may cause shell exceptions.

1. first introduce the usage of alias (alias) Alias la = 'LS-a' alias B = 'CD... 'and so on Alias is a good thing. It can save a lot of time when using shell. 2. But one day I found that the if statement cannot be used when executing the shell script, the following error will be reported: Bash: build/envsetup. sh: line 30: syntax error near unexpected token 'the

An alias error in the bash configuration file may cause shell exceptions.

1. first introduce the usage of Alias (alias) Alias LA = 'LS-a' alias B = 'CD... 'and so on Alias is a good thing. It can save a lot of time when using shell. 2. But one day I found that the if statement cannot be used when executing the shell script, the following error will be reported: Bash: build/envsetup. sh: line 30: syntax error near unexpected token 'the

The most basic syntax for bash shell

1 Basic composition of shell statementsThe shell is separated by a space between each basic constituent element.For example, [-E file],[,-E, file,] these four basic elements are separated by a space.Same reason [!-e file],[,! ,-E, file,] each of these five basic elements is separated by a space.2 Shell If expression combine! , A, O, respectively, and and OR, do n

Basic Bash Shell command--2

end the process, and wildcard characters are supported.Eg:killall http*4.mountMount the media and output the device mounted on the current system.Eg:mount-t Vfat/dev/sdb1/media/disk manually mount the USB drive/dev/sdb1 to the/media/disk.5.umountUninstall the mobile device.Eg:umount/home/usr/mnt6.dfView the usage of all mounted disks.7.duDisplays disk usage for a specific directory.8.sortSort the data, sort commands the data in the text file according to the collation of the default language. W

Linux terminal and TTY who echo command usage and Shell bash variables

Linux terminal is divided into physical terminal, pseudo terminal, serial terminal, virtual terminalPhysical Terminal:/dev/consolePseudo terminal (terminal under Remote terminal graphics):/dev/pts/# (digital)Virtual Terminal:/dev/tty#Serial Terminal:/dev/ttys#StartX Start the graphical interfaceCTRL + C cancels the command being executedShift+pageup/pagedown screen in command screenTTY command displays current terminal end device filesWho command to view all accounts logged on the current system

Bash Shell's parametric symbolic meaning

Some arguments are used in the Bash Shell, $1,$2,... A specific number of parameters, the name of the currently executing process name, the script itself, or the whole row output in a regular expression $# the command line or the number of positional arguments $* all positional parameters, being used as a word. $@ is synonymous with $*, but each argument is a separate "" reference string, which means th

A scripting language, learning Bash is a waste of time?

First bash, although there are if_else, can tune the system commands. But many limitations, such as not supporting multi-threading, have no libraries. So it's not necessary for PY or Ruby to learn bash again. Reply content:Daily work, a lot of things are very trivial and detailed, you can not imagine you will encounter any specific small task. At this point, you can't always open vim and write a Python scri

[Android] installs busybox--full bash shell for Android (favorites)

Have you ever had this experience, enter the ADB shell at the command line, and then use the command to manipulate your phone or simulator, but those commands are a shrinking version of the common Linux commands, which is very uncomfortable to use. Ever thought about using a more complete shell on Android? Use BusyBox. Whether using the ADB connection device using the command line or directly on the phone w

[Android] install busybox for Android-the complete BASH Shell

Have you ever had this experience? input ADB shell in the command line and then use the command to operate your mobile phone or simulator. However, these commands are common Linux commands, which are not easy to use. Have you ever thought about using a complete shell on Android? Use busybox. You can use terminal emulator either by connecting to the device using the ADB command line or on your mobile phone.

Install busybox for Android-the complete BASH Shell

Have you ever had this experience? input ADB shell in the command line and then use the command to operate your mobile phone or simulator. However, these commands are common Linux commands, which are not easy to use. Have you ever thought about using a complete shell on Android? Use busybox. You can use terminal emulator either by connecting to the device using the ADB command line or on your mobile phone.

[Shell] Bash variables: numeric operations and operators

-------------------------------------------------------------------------------------------------The types of variables in the shell are all strings by default, so:#!/bin/Bashaa=1bb=2cc= $aa +$bbEcho $cc 1+2Number of ways to calculate:Declare declares the type of the variable:    declare [+/-] [option] Variable nameOptions:-: Set type attribute to variable+: Cancels the Type property of a variable-I: Declaring a variable as an integer (int)-x:

Bash Shell Basic Features II

Bash Shell Basic Features II(1) globbingText name wildcard: Meta characters*: matches any character of any length;?: matches any single character;Example: A*b:aab, AB, a123b;A?b:[]: matches any single character within the specified range;Example: [0-9][^]: matches any single character outside the range;Example: [^a-b]Character Set:[: Lower:] matches lowercase letters. Equivalent to A-Z[: Upper:] matches upp

Bash shell, call FFmpeg periodic screenshot

#!/bin/bash# gets all m3u8 files in the current directory, and Var=$(ls|grep '. m3u8'|Cut-D'.'-F1) #死循环 while[1=1 ] Do#循环每个文件 forStreaminch$var Do#获取当前最新视频文件 TS=$(ls-t|grep "$stream") for file inch$ts Do#存储M3U8文件文件名作为图片文件名, for* -, capturing the first frame, stored in the current directory of the Screen folder img=$(ls$file|Cut-D'-'-F1) #调用ffmpeg intercept video FFMPEG2-I. $file-y-f image2-s -* --vframes1screen/$img. png #跳出循环break Done Do

Solve the problem of CentOS shell display-bash-4.1$ does not display the user name path

Problem Description: CentOS A new user, log in after the information of the shell script is as follows: Linux CentOS Shell display-bash-4.1$ does not display the user name path solution Ps: If you mistakenly delete files in the user directory, it may also lead to! The/root/directory was accidentally emptied before the wind, which led to a similar situation; S

Initialize the bash shell script for Oracle users and tablespaces

The Linux script has not been written for a long time. Suddenly there is a need to write a bash shell script to initialize Oracle users and tablespaces. Make a record for future Query Call method:./user. sh oracle/u01/app/oracle/data_01.dbf/u01/app/oracle/index_01.dbf The content is as follows: #! /Bin/bash#./User. sh oracle/u01/app/oracle/data_01.dbf/u01/app/ora

There are four ways in which the Bash Shell's arithmetic operations

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~1: Using expr external programAddition R= ' Expr 4 + 5 'Echo $rAttention! ' 4 ' + ' 5 ' There should be a gap between the threeR= ' Expr 4 * 5 ' #错误Multiplication r= ' expr 4 \* 5 '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~2: Use $ (())r=$ ((4 + 5))Echo $r~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~3: Use $[]R=$[4 + 5]Echo $rMultiplicationR= ' Expr 4 \* 5 'r=$ ((4 * 5))r=$[4 * 5]Echo $rDivisionr= ' Expr 40/5 'r=$ ((40/5))r=$[40/5]Echo $rSubtractionr= ' Expr 40-5 'r=$ ((40-5))r=$[40-

Linux shell Programming-bash artifice

; Myscript.shchmod 755MyScript.SH./myscript.SHAbc"123 def"The result is:ABC 123 DEFABC 123 defFor loops using arraysThe values of the array are sequentially in the loop, which can be used ${arr[@} and ${arr[*]}, and the difference between the differences and the quotation marks is the same as the use of the above positional parameters.String matchThe Shell's string match is usually the case:" ABC " " ABC " ]echo0Returns 0 if the string is the same, otherwise returns 1. In addition to the full ma

Shell Bash determines whether a file or folder exists

Shell Bash determines whether a file or folder exists1, #如果文件夹不存在, create Folders folder="Log"if[!-D"${folder}" ]; Then mkdir ${folder}fi2To determine if a file exists.="/var/www/log.txt"# -The f parameter determines whether the $file existsif[!-F"$file" ]; Then Touch"$file"Fi,3、# -n Determine if a variable has a valueif[!-N"$var" ]; Then Echo"$var is empty"Exit0F4# Determine if two variables are equalif["$

Shell Basics-Bash basic features

for password inputcode example:#! /bin/Bash Read-TTen-P"Please input your name:"name# Prompt Please enter name, wait 10 seconds, save user input to variable name nameEcho "Name is $name"Read-s-tTen-P"Please enter your age:"age# age is privacy, with"- S"option to hide inputEcho-E"\ n"Echo "Age is $age"Read-N1-TTen-P"Please select gender[m/f]:"gender# Use"- N 1"option to receive only one input character will be executed (no carriage return)Echo-E"\ n"E

Array Bash shell

[@]} $1) echo"Add Success"unset unlastip[j] #从数组中删除原数 echo"Current Online host list: ${lastip[@]}"m=${unlastip[@]} unlastip=($m) #删除后剩余数组内容重新赋值给数组 echo"currently not online host list ${unlastip[@]}"Unlength=${#unlastip [@]} # length=${#lastip [@]} #fi} while:; Do# Dead Loop # Improved loop, Unset${lastip[i]} Remove the ping IP in the arrayif(($length >0) ; then # Online host list non-empty to check the list of whether the host is really online, if not the line PS function will be offline host ki

Total Pages: 15 1 .... 11 12 13 14 15 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.