Shell gets the file name extension

cos

basename example.tar.a.b.c.gz. c.gz # => example.tar.a.b file= " example.tar.gz" echo "${file%%.*}" Fetch Head Example # => example echo "${file%.*}" go tail example.tar.a.b.c # => Example.tar echo "${file#*.}" Go head

Shell basic Syntax and commands

Execute scriptWrite a simple script test.sh:#! /bin/shCD. LSThe shell script uses # notation, which corresponds to the C//comment. However, if # is at the beginning of the first line and is #! (called shebang), the exception is that the script uses

Shell programming (handwritten notes)

I. OverviewThe shell is a program written in C that provides access to the operating system kernel services through a shell user. It is similar to DOS command and later cmd.exe. The shell is both a command language and a programming language.Shell

The meaning of shell variable $#,$@,$0,$1,$2 in Linux is explained:

Variable Description:$$ Shell本身的PID(ProcessID) $! Shell最后运行的后台Process的PID $? 最后运行的命令的结束代码(返回值) $- 使用Set命令设定的Flag一览 $* 所有参数列表。如"$*"用「"」括起来的情况、以"$1 $2 … $n"的形式输出所有参数。 [email protected]

Linux Learning-Advanced shell scripting (a) function

Citation: Usually when you write a shell script, you'll find that there are many places that use the same code or the same functionality. If it's a small code, it doesn't matter. But if you use it more than once and it's the same code, I think

How to use the Linux shell if statement

Original address: http://blog.chinaunix.net/uid-24607609-id-2118151.htmlThe syntax for the most streamlined if command is:if TEST-COMMANDS; then CONSEQUENT-COMMANDS; fiafter the Test-command executes and its return status is 0, the

Mathematical calculations/operations in the shell

Assignments and operations in the shell are string-handling by default.1) Use let (integer only)Var=1Let "Var+=1"Echo $varOutput is 2Attention:A) Let almost all operators are supportedb) Power operation should use "* *"c) parameters are accessed

Explanation of the meaning of shell variable $#,$@,$0,$1,$2 in Linux

The meaning of shell variable $#,[email protected],$0,$1,$2 in Linux is explained:Variable Description:$$The PID of the shell itself (ProcessID)$!PID of the Shell's last running background process$?End code of the last Run command (return

VPC shell encryption in windows within 3 minutes

Plants use shells to protect seeds and animals use shells to protect the body,ProgramThe shell is used to protect the software from decompiling or tampering. The shell encryption is a technology of Software Encryption and an extremely important

Shell programming Basics

We can use any text editor, such as gedit, kedit, emacs, VI, to write shell scripts. It must start with the following line (the first line of the file must be placed ): #! /Bin/sh... Note: It is best to use "! /Bin/bash "instead of"! /Bin/sh ",

[Shell] arithmetic in Shell

Shell script variables are processed as strings rather than numbers by default, which makes it complicated to perform mathematical operations in shell scripts. Perl and python will be a better choice to maintain Script Programming specifications and

Processing of command line options and parameters in Shell

In Bash, you can use the following three methods to process command lines:ParametersEach method has its own application scenario.1. perform direct processing, parse $1, $2,..., $ N in sequence, and perform manual processing respectively;2. getopts

Shell:. bash_profile and. bashrc)

/Etc/profile: This file sets the environment information for each user in the system. When the user logs on for the first time, this file is executed.And collect shell settings from the configuration file in the/etc/profile. d directory./Etc/bashrc:

Bash basics and shell programming Basics

Bash Basics   About commands and command types Use the hash table for the command Bash to accelerate the next search. To add a frequently used command, use the hash cmdBash executes commands with the same name in the path in the following sequence:

Example of the hadoop configuration file automatically configured by Shell

xsl

#!/bin/bashread -p 'Please input the directory of hadoop , ex: /usr/hadoop :' hadoop_dirif [ -d $hadoop_dir ] ; then echo 'Yes , this directory exist.'else echo 'Error , this directory not exist.' exit 1fiif [ -f

Linux shell configuration files

Document directory Login shell vs non-login shell . Bash_profile vs. bashrc Which file is written? When working in a Unix * like environment, you may encounter bash environment variable configuration. Every time you face some. Bash * files in

Use the command line editing function provided by shell to select set-o vi or set-o emacs!

After logging on to the system today and logging on to N commands, I habitually used the upward arrow key to find the historical commands. I suddenly saw this: $ ^ [[A ^ [[A ^ [ Press the delete key to display the following information:$ ^ HYou can

Introduction to Shell variable Programming

• Shell programming: Shell Variables1_1 system variableLimit 2 Shell user Variables■ 2.1 Basics■ 2.2 tips■ Array in 2.3 shellEnvironment Variable 3 shellLet's take a look at Shell variables instead of Shell versions. There are three variables in

Shell Command sshpass non-interactive SSH password verification, sshpassssh

Shell Command sshpass non-interactive SSH password verification, sshpassssh Shell Command sshpass non-interactive SSH password verification # Install sshpasssshpass : Http://sourceforge.net/projects/sshpass/ Download it as a tar.gz compressed

Test data center network connectivity and latency (shell script)

Test data center network connectivity and latency (shell script) Failover (mobile) Script 1 :#! /Bin/bash ping-c 100 $1> test/temp _ $1 tail-n 3 test/temp _ $1 traceroute $1 script 2: the task is scheduled to be executed every 15 minutes :#!

Total Pages: 541 1 .... 69 70 71 72 73 .... 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.