Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Construction of CentOS 7 Shell script programming Lottery Network platform

2025-02-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report