Shell Programming (iii)

Source: Internet
Author: User
Tags clear screen

Bash basic features: command line expansion

~: Automatically expands to the user's home directory, or the specified user's home directory;

{}: A comma-delimited list of paths can be hosted and can be expanded to multiple paths;

For example:/tmp/{a,b} is equivalent to/tmp/a/tmp/b


Exercise: Create the following directory structure:

/tmp/mysysroot/

|--bin

|--etc

| '--Sysconfig

| '--network-scripts

|--Sbin

|--usr

| |--bin

| |--Lib

| |--lib64

| |--Local

|   | |--bin

|   | |--etc

|   | |--Lib

|   | '--sbin

| '--sbin

'--Var

|--Cache

|--Log

'--run


~]# Mkdir-pv/tmp/mysysroot/{bin,sbin,etc/sysconfig/network-scripts,usr/{bin,sbin,local/{bin,sbin,etc,lib},lib, Lib64},var/{cache,log,run}}


Tree command:

tree [options] [directory]

-L Level: Specifies the hierarchy to display;


Bash's underlying features: command execution status results


Status result of the command execution:

Bash outputs this result with a status return value:

Success: 0

Failed: 1-255


After the command execution completes, its status return value is saved in Bash's special variable $?


When the command executes normally, some return the command value:

Depending on the command and its function, the results are different;


The execution result of the reference command:

$ (COMMAND)

or ' COMMAND '


Bash-based features: references

Strong quote: '

Weak reference: ""

Command reference: '


Bash Basic features: shortcut keys

CTRL + A: Jump to the beginning of the command line

Ctrl+e: Jump to the end of the command line


Ctrl+u: Deletes all the characters from the beginning of the line to the cursor position;

Ctrl+k: Removes all characters from the cursor to the end of the line;


Ctrl+l: Clear screen, equivalent to clear


Shell Programming (iii)

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.