Sometimes it is necessary to write some timed task scripts, a brief summary, memos.
>>> import datetime
>>> datetime.datetime.now()
datetime.datetime(2018, 5, 23, 17, 16, 33, 61000)
>>> print
Sometimes it is necessary to write some timed task scripts, a brief summary, memos.
>>> import datetime
>>> datetime.datetime.now()
datetime.datetime(2018, 5, 23, 17, 16, 33, 61000)
>>> print
let usage method [email protected]:/tmp# n1=5
[email protected]:/tmp# n2=10< br />[email protected]:/tmp# let result=n1+n2
[email protected]:/tmp# echo $result
15
[email protected]:/tmp# let n1++
[
test.sh
#!/bin/bash
echo “Script name$0”
echo “The first parameter $1”
echo “The second parameter $2”
echo “The third parameter $3”
echo “The fourth parameter $4”
echo “The fifth parame
Question requirements Write a greeting program that can output greetings to the user according to the current time of the system when it is executed. Assume that from midnight to noon is morning, n
test.sh:
#!/bin/bash
myUrl=”http://www.google.com span>”
readonly myUrl
myUrl=”http://www.runoob.com span>” Output
bogon:Desktop macname $ ./test.sh
./test.sh: line 4: myUrl: reado
1. Special location variables
About the above related variables introduction , You can also refer to the man manual, execute the command “man bash”, and then search for the keyword “Special P
Interactive input and for statement (8-15)
Interactive input
1, read Usage: The read command can define multiple variable values at the same time, and the input content can be used as
Shell-06 function #Write a script, use the chkconfig command, loop execution, and close all 5 levels of services
#!/bin/bash
name=`chkconfig –list | cut -d’ span> ‘ -f1`
for i in [name
Question requirementsprompt the user to enter the name of the network card, and then we use the script to output the ip of the network card, we need to consider the following questions:
?
#!
1, define a command alias that is effective for all users, for example: lftps=’172.168.0.1/pub’
echo “alias lftps=’172.168.0.1/pub'” >> /etc/bashrc && source /etc/bashrc 2, display all lines