bash scripting basics

Alibabacloud.com offers a wide variety of articles about bash scripting basics, easily find your bash scripting basics information here online.

Bash basics man Manual

Bash basics man ManualBash's basic knowledge man manual is implemented by various terminals because penetration tests based on Android devices. Therefore, it is particularly important to master Shell-related operations. Bash is a Unix Shell program written for GNU. This document selects the Kali Linux penetration test tutorial Based on Android devices.It is a She

Linux notes: Shell basics and Bash's basic features

:/user Home Directory/.BASHRCThird, bash common shortcut keysCTRL + C forces the current command to terminateCtrl+u the command before deleting or cutting the cursorCtrl+l Clear ScreenCtrl+y Paste Ctrl+u Cut contentCtrl+d exiting the current terminalIv. Input and output redirectionStandard input: Keyboard. File Descriptor: 0Standard output: Monitor. File Descriptor: 1Standard error Output: Monitor. File Descriptor: 2Standard output redirection:Five, m

Linux Basics (8) About bash configuration files

) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/84/21/wKiom1eGKW3x5bL4AADI8EjII00071.jpg-wh_500x0-wm_3 -wmp_4-s_1359371015.jpg "title=" 0.jpg "alt=" Wkiom1egkw3x5bl4aadi8ejii00071.jpg-wh_50 "/>The order in which the configuration files are read for the login shell./etc/profile--/etc/profile.d/*.sh--and ~/.bash_profile--~/.BASHRC--/ETC/BASHRCThe order in which the configuration files are read for non-logged shells.~/.BASHRC--/ETC/BASHRC-/etc/profile.d/*.shThis article is from the "thick P

Linux Learning-Shell Basics-Bash basic features

   Historical command  History-C Clear-W Write ~/.bash_historySave 1000 By default, can be modified in /etc/profileCall      TAB completioncommands, directories, files Command aliasesAlias aliases = ' Original command 'Command execution order:Absolute path or relative path > alias > Bash's internal command > The first command found in $PATH environment variable (external command)Configuration file:/ROOT/.BASHRCDelete: Unalias aliasesCommon shortcut keys   Input and output redir

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

Linux Shell Basics-Bash variables-environment variables-positional parameter variables-predefined variables

represents the first to the Nineth parameter.When executing the script file:./canshu.sh 11 22 3305. Pre-defined variables$$: Output when the forward PIDThis PID is the PID of the generated process when variable,sh this script executes;06. Receive keyboard input = + red [option] [variable name]-P "prompt message": When waiting for the read in and out, the output prompt read command will wait for user input, use this option to specify the time to waitThe-t:read command waits for user input, using

Learn more about Linux Shell Scripting Basics (eight)

command. You can use Echo to print any variable value in any place where you suspect it is wrong. That's why most shell programmers spend 80% of their time debugging programs. of the Shell programThe advantage is that there is no need to recompile, and it does not take much time to insert an echo command.The shell also has a real debug mode. If there is an error in the script "Strangescript", you can debug it this way: Sh-x Strangescript This executes the script and displays the values of all v

Shell Scripting Basics (eight)

.txt[[emailprotected] sbin]# ./05.expect 192.168.242.129 /tmp/123.txtspawn rsync -av /tmp/123.txt [emailprotected]:/tmp/123.txt[emailprotected]‘s password: sending incremental file list123.txtsent 71 bytes received 31 bytes 204.00 bytes/sectotal size is 0 speedup is 0.00Iii. building a file distribution system Requirements background: For large companies, there must be a site or configuration file updates from time to time, and the use of the machine is certainly a lot of units, fewe

Some of the basics of using Linux and bash

:- C: empty command history-D: Delete the specified command history, offset [n]-W: Saves the command history of the buffer to the history file/home/username/.bash_history !n: Executes the nth command in the command history!-n: Executes the last nth command in the command history!!: Executes the previous command!string: The most recent command in the command history that starts with a specified string!$: Referencing the last parameter of the previous commandESC. Command aliases:Alias--View the c

Linux Basics--Bash

${shell}", Output: User shell Is/bin/bash, complete variable substitution' |$ (): command substitution, nesting a subcommand in a command and replacing it with output resultsecho "Work dir is $ (pwd)", Output: Work dir is/rootecho "Work dir is ' pwd '", Output: Workdir is/rootTouch file$ (date +-%y-%m-%d-%h-%m-%s). txt, the output is: file-2016-05-01-09-12-07.txt(3) file wildcard character, globbing (man 7)*: matches any character of any length?: mat

Little Ant learns Linux (9)--shell Basics and bash basic features

sequence bit executes the first command found in the order of the directories defined by the $PATH environment variable.2. Common shortcut keysCTRL + C terminates ctrl+e cursor fast to end of lineCtrl+l Clear Screen Ctrl + Z put commands into the background (not recommended)Ctrl+u Delete full row ctrl+r search in history command CTRL + A cursor jumps to the beginning of the line3. Historical orderHistory "Options" "Historical command Save File"Option:-C clears the history command (not recommend

Shell Scripting Basics (bottom)

]shell]#catfun1.sh#/bin/bashread-p "Please enter the network card:" networkip () {ifconfig $network |head-2|tail-1|awk -F ': ' ' {print$2} ' |awk ' {print$1} '}case $network ineth* ) echo "This is the Ethernet NIC," ipaddr= ' ip $network ' echo ' $network IP is: $ IPAddr ";; lo) echo "This is the loopback network card" ipaddr= ' ip $network ' echo "$network IP is: $ipaddr" ;; *) echo "You entered the incorrect, please new input!" ";; EsacExtended Learning:Select is also a kind of loop, it is

LUA Scripting language Basics

much like a C-language functional pointer? Like the C language, Lua's functions can accept a variable number of parameters, which are also defined by "...", such as:function sum (A, B,...)If you want to get ... Represents the parameter that can be obtained by accessing the ARG local variable (table type) in the function.such as SUM (1,2,3,4)Then, in the function, a = 1, b = 2, arg = {3, 4}More valuable is that it can return multiple results at the same time, such as:function S ()Return 1,2,3,4E

Shell scripting basics, using variables, conditional testing and selection, and list-looping

listDoCommand sequenceDoneFor a in Zhangsan Lisi Wangwu DCDoUseradd $aDoneVariable a participates in the loop, and the variable a value affects the result of the loop[Email protected]/]# vim/root/for.sh#!/bin/bashFor a in Nsd11 nsd12 nsd13 nsd15DoUseradd $aEcho $a created successfullyDoneVariable A does not participate in the loop, and the variable a value does not affect the result of the loop#!/bin/bashFor a in 1 2 3Do echo hello worlddone[Email protected]/]# cat/root/num.sh#!/bin/bashnum

Shell scripting basics, using variables, conditional testing and selection, and list-looping

Http://classroom/pub/materials/userlist[Email protected]/]# vim/root/batchusers#!/bin/bashIf [$#-eq 0];then//$ #位置变量的数量, when no arguments are provided, the $ #为0, the expression is setEcho ' Usage:/root/batchusers ' >2//output Usage:/root/batchusers >2 into error outputExit 1//Return value 1, prompt for wrong input parameterselif [!-F $];thenEcho ' Input file not found ' >2Exit 2FiFor a in $ (cat $)DoUseradd-s/bin/false $aEcho $a created successfullyDone########################################

Shell Scripting Basics App (ii)

whether the VSFTPD service is running, if it has been run to list its listening address, PID number, otherwise the output hint "VSFTPD service is not available!" ”First install the VSFTPD software, turn on the VSFTPD service (software CD)Then write the script vim chkftpd.sh[Email protected] ~]# chmod +x chkftpd.sh[Email protected] ~]#./chkftpd.shJINGGAO:VSFTPD fuwubukeyong!Set permissions and execute to prompt vsftpd service not availableExecute script again after opening VSFTPD server3. Multi-

My Way on Linux-[Shell Basics]-a common method of judging whether a file, directory exists, or whether it has a certain class of attributes (permissions) in the Bash shell

comparing the timestamp implementation of the file /c2>-ef file, to determine whether File2 and File2 is the same file, by judging the two files pointing to the inode is the same to achieve, can be used in hard link decision# Two integers in a comparison-eq #equal equals -ne #not equal not equal -GT #greater than greater than - Lt # less than smaller than -ge #greater than or equal greater than or equal to-le # less than or equal smaller than or equal to# Multiple c

Linux bash-Script Basics

Script execution:The script starts a child shell process when it executes. Scripts that are started on the command line inherit the current shell environment variables, and the system-initiated scripts (not command-line launches) require a self-defined amount environment variable.Program Status Return code:0: Execute correctly.1-255: Error execution, 1, 2, 127 system reserved.Exit Role Exits script execution, which defines the execution state of the script. If the script does not explici

Linux Command Bash Basics (command completion vs. hash cache)

Enter the command. Then press the TAB key to implement the command auto-completion, and a command to complete the command. There are multiple matching commands that are listed as a list,For example:Input command, IP, will list all the commands that begin with IP,After the command executes, it is saved to a command cache file directory called hash.Can be viewed by hash, to see the help of the hash command, helping hash,This article is from the "No God Buddha" blog, please be sure to keep this sou

2017-11-5linux Basics Bash Basic Features

] ... SET1 [SET2] usage 2:# tr-d SET1 It is important to note that this command does not modify the source file.Iv. PipelinesA pipeline is a connection between a command and a command, and the principle is to pass the output of the COMMAND1 through the pipeline to COMMAND2, which directs the output of the previous command directly to a program and treats it as its data stream. Use the following:# COMMAND1 |COMMAND2 | COMMAND3So let's talk about the tee command, which is used to output standard i

Total Pages: 6 1 2 3 4 5 6 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.