Linux08--shell Programming the shell script

Source: Internet
Author: User

First shell script--helloworld

[Email protected] ~]# VI sh01.sh#!/bin/bash #! Indicates which shell# this is my first shell script #注释部分echo-E "Hello world!" Exit 0[[email protected]~]# SH sh01.sh   # execute SH file Hello world! using bash or SH command

Second shell script--Receives user input from the terminal into the variable

  

Third shell script--Create a new file from the terminal receiving user input file name

The date command +%y%m%d is a parameter, and the argument after the command is preceded by a minus sign, and in some cases, preceded by a plus ' + ' case

In a string of commands, you also need to provide information through other commands, which can be used with the "inverted single quote or $ ()

Execute SH sh03.sh

Fourth shell script---numeric operation

The numeric operations in the shell script only support integer operations; the variables in the shell script default to Strings , so if you want variables to perform numeric operations, there are two ways to do this: • The first is to use $ ((numeric expression)), such as $ ( first+ $last))• The second declares a variable as Integer: declare–i total= Numeric Expression sum=$ (($first + $second))

Linux08--shell Programming the shell script

Related Article

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.