Get the App
SLTechnology News&Howtos  ›  Servers  › 

Construction of CentOS 7 Shell script programming Lottery Network platform

Shulou Source: shulou.com Published: 2022-06-03 04:12:30 10月14日 Update

Shell is commonly used to build built-in lottery network platforms. If you need it, please find [Great God Source Forum] dsluntan.com. Consult Qie 3393756370 for details. The main commands are cd, command, echo, command, evel, exec, exit, export, hash, help, history, kill, printf, pwd, set, shift, type, unset, unalias and so on. There are also several symbolic commands, such as.,:, and [.

First, the commonly used command echo is introduced. The echo command has been used many times in the previous article. This article only explains the usage of-c,-e and-n.

#-n output content without line wrapping

[root@promote] # echo-n 'hello'; echo 'tom.'

Hello tom.

#-c cancel escape character

[root@promote ~] # echo-c "tom\ t bill\ t name"

-c tom\ t bill\ t name

#-e parsing escape characters

[root@promote ~] # echo-e "tom\ nbill\ nname"

Tom

Bill

Name

#\ t horizontal tab

[root@promote ~] # echo-e "tom\ t bill\ t name"

Tom bill name

#\ v Vertical Tab

[root@promote ~] # echo-e "tom\ vbill\ vname"

Tom

Bill

Name

#\ b Delete the previous character

[root@promote ~] # echo-e "tom1\ bbill1\ bname"

Tombillname

[root@promote ~] #

Printf commands are more complex and efficient than echo, such as character formatting. More complex operations can be performed.

[root@promote ~] # cat ev1.sh

#! / bin/bash

Dirpath=/root/

Cmd= "ls-l $dirpath | awk-F'{print\ $9}'"

Eval $cmd

[root@promote ~] # bash ev1.sh

Anaconda-ks.cfg

Echohello.sh

Ev1.sh

Test

Testprint1.sh

Test.txt

Users

[root@promote ~] # vim ev1.sh

# modify the code cmd= "ls-l $dirpath | awk-F'{print\ $2}'"

[root@promote ~] # bash ev1.sh

[root@promote ~] # vim ev1.sh

# modify the code cmd= "ls-l $dirpath | awk-F'{print\ $1}'"

[root@promote ~] # bash ev1.sh

Total dosage

-rw-.

-rw-r--r--.

-rw-r--r--

Drwxr-xr-x.

-rw-r--r--

-rw-r--r--.

-rwxr-xr-x.

[root@promote ~] #

# isn't it a little deja vu?

Exec can execute the specified command without creating a new process. After the command is executed, exec exits synchronously.

Exit exits the shell program.

Tags: Commands characters complexity code tabs common use escape tabulation platform deja vu content god format level source code usage programs symbols forums details Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MySQL macOS Docker Shulou Tech Info