learning bash shell

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

Linux Bash Shell string truncation, bashshell

Linux Bash Shell string truncation, bashshell #! /Bin/bash# No space is allowed on both sides of the equal sign when the variable is assigned a value. Otherwise, the command does not exist.# Run shell scripts in two ways#1. As the interpretation parameter/bin/sh test. sh; 2. As the executable file chmod + x./test. shBl

Solution: show only-bash-4.1 in shell command line # Do not show users and paths

Solution: show only-bash-4.1 in shell command line # Do not show users and pathsToday, I accidentally typed the home Directory deletion command. Although it was not deleted for various reasons, many files and directories in the home directory were deleted, the command line does not display the current user and path. Next, you need to set two files for resetting :~ /. Bashrc and ~ /. Bash_profile1. Create a.

Bash shell commands and monitoring that little Thing (ii)

Top of the Bash shell Command and monitor  The last time we talked about the PS command, although the PS command is useful in collecting process information running on the system, but there are shortcomings, PS command can only display information at a specific point in time, if you want to observe the trend of the process of swapping out memory frequently, it is inconvenient to use PS command.and the top c

bash shell shortcuts [go]

Living in the Bash shell, memorizing the following shortcuts will greatly improve the efficiency of your command line operations.Edit command Ctrl + A: Move to the beginning of the command Ctrl + E: Move to the end of the command line Ctrl + F: Move forward by character (right) Ctrl + B: Move back by character (left) Alt + F: Move forward by word (right) Alt + B: Move back by wo

Comparison in bash shell

True[-W $var] #变量所示文件可写, returns True[-R $var] #变量所示文件可读, returns True[Email protected] test]# ls-ltotal 4-rw-r--r--.1 root root 1 23:47 test.sh[[email protected] test]# [[-X test.sh]];echo $? #因为test. SH does not have execute permissions, so $?Not equal to 01[[email protected] test]# [[-W test.sh]];echo $?] 0[[email protected] test]# [[-R test.sh]];echo $?0[-L $var] #变量所示是符号链接, return True[-B $var] #变量为块设备文件, returns True[-C $var] #变量为字符设备文件, returns True[[Emailprotected]dev]#ls-l|grepcdrlrwxr

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

Bash Shell built-in commands and reserved words

Bash Shell built-in commands and reserved wordsCommandMeaning!Reserved words, logical non-:Don't do anything, just do the parameter expansion.Read the file and execute it in the shellAliasTo set a command or command-line aliasBgTo run a job in the backgroundBindBundle a keyword sequence with a readline function or macroBreakReserved words, jumping out for, while, until, select loopsBuiltinInvokes the comman

Linux CentOS shell display-bash-4.1 $ solution for not displaying the user name path

Linux CentOS shell display-bash-4.1 $ solution to the problem where the path of the user name is not displayed: a new user is added under CentOS. After logging in, the shell script information is as follows: instead of the username @ hostname combination we often see, it looks uncomfortable. Solution: the cause of the problem is that the. bash_profile is not conf

Shell introduction: bash programming execution

Article title: shell introduction to bash programming execution. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source. There are five methods to execute a command in the Bourne Shell, and the results of these five methods are diffe

Bash Shell First lesson

Self-taught shell, and was taught by the teacher, English class do not study English four how to live, haha, that there is no data on my attractiveness, ah, for love and dream!!!Recall the file format: filename with an. sh extensionFile content at the beginning must be #!bin/bash (note that their Chinese and English switch after all is terminal login)Add comment to # in fileecho $? For 0 means the command w

Bash-shell-scripts Advanced Script Configuration IP address

[[emailprotected]shell]#catmod_ip_hostname.sh#!/bin/bash#automodify Ipandhostname#bycolinon2015-05-07ip_config= '/etc/sysconfig/network-scripts/ Ifcfg-eth0 ' hostname_config= '/etc/sysconfig/network ' hosts_config= '/etc/hosts ' #定义一个IP主要内容数组a =0# Defines the variable a as an array subscript, dynamically used when calling ip_array[a]ip_array= (IPADDRNATMASKGATEWAYDNS1DNS2) #判断IP是否符合标准规则function judge_ip ()

GNU Bash 'Shell. c' security measure Bypass Vulnerability

Release date:Updated on: Affected Systems:GNU Bash 4.3Description:--------------------------------------------------------------------------------Bugtraq id: 67803Bash, a Unix shell, was written by Brian fox for the GNU program in 1987.GNU Bash 4.3 and other versions have security vulnerabilities. Remote attackers can exploit this vulnerability to bypass certain

Shell base-bash variable-user-defined variable

Variable setting rules:Variable names can consist of letters, underscores, and numbers, but cannot start with a number.The default type of a variable in bash is a string type, and if a numeric operation is required, specify the variable type as numeric. The variable is linked with an equal sign and cannot have spaces on either side. If a space is required, enclose it in single or double quotation marks.The "\" in the

[Shell] Bash variables: Custom variables

result of the command as a variable value , you need to use the back quotation mark or the $ () containing command.name=' ls ' or name=$ (LS)Echo $name8. The environment variable name is recommended capitalization, easy to distinguish.Two. Variable classification1. User-defined variables (also called local variables).2. Environment variables: The data stored in the variable is related to the operating environment of the system. (value cannot be changed, can be created)3. Positional parameter va

Write a bash shell script

Write a bash shell scriptThe script is as follows: it is used to monitor the number of mongo connections and restart the system.#! /Bin/bash# Source/etc/profileConn = '/usr/bin/mongo -- quiet Db. serverStatus (). connectionsExitEOF`Conn1 =$ {conn #*:}Curr =$ {conn1% ,*}# PID = $ (ps-ef | grep "mongodb" | grep-v grep | awk '{print $2 }')Echo "$ curr"If [$ curr-le

The CentOS shell command line only shows that the-bash-4.1# does not show the user and path resolution

 today accidentally hit the home directory Delete command, although finally for a variety of reasons did not delete, but the home directory, many files and directories are deleted, and the command line does not display the current user and path. Reset It below to set two files: ~/.BASHRC and ~/.bash_profile1. BASHRCcreate a new. bashrc file under the current directory:# Touch ~/.BASHRC# vim ~/.BASHRC and enter the following data#. BASHRC# Source Global Definitionsif [-F/ETC/BASHRC]; Then./ETC

Linux CentOS under the shell display-bash-4.1$ does not display the user name and host name of the workaround

New CentOS Add a user, log in to find that the shell script information does not display the user name and host name, but instead shows the-bash-4.1$, instead of the [email protected]$ combination that we often see, looks particularly uncomfortable.The cause of the problem is because there is no configuration. Bash_profile problem, or no problem with this file, you can configure or create a new file to solv

Bash Shell Foundation feature theory + case study

= "Ignorespace" 17history[[emailprotected]~]#2. Command completion and path completionThere are many commands and paths in Linux, and it is unavoidable to forget that the command completion feature provided by the Bash shell compensates for this flaw. Just give the first few letters of the command, bash looks for a file named after the given command name from le

Linux Shell script error:/bin/bash^m:bad interpreter:no such file or directory

Today, there is a very strange problem, the shell script that has been running very normal failed, but yesterday added a parameter.Error message:/bin/bash^m:bad interpreter:no such file or directoryLater found that root cause, modified the file yesterday in Windows modified save, and then uploaded. The file is recognized as a DOS format.Use the following command in this command mode to view:: Set FFreturn R

Shell (Bash) programming instance to get all file names (including folders) in a folder)

The Shell (Bash) programming instance obtains all the file names (including folders) in a folder. Many of them do not understand it, so they record all the files they actually use, I hope the experts will give you more valuable comments. Thank you www.2cto.com [plain] #! /Bin/sh #============= get the file name ============= Folder_A = "/home/youname/ shell/gotfi

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.

not found

404! Not Found!

Sorry, you’ve landed on an unexplored planet!

Return Home
phone Contact Us
not found

404! Not Found!

Sorry, you’ve landed on an unexplored planet!

Return Home
phone Contact Us

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.