Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux script #2

Open
linrio opened this issue Jun 29, 2016 · 3 comments
Open

linux script #2

linrio opened this issue Jun 29, 2016 · 3 comments

Comments

@linrio
Copy link
Owner

linrio commented Jun 29, 2016

python script

@linrio
Copy link
Owner Author

linrio commented Jun 29, 2016

replace_reg = re.compile(r'0.\d+')
:complie the regular expression to Regular Expression Objects replace_reg

@linrio
Copy link
Owner Author

linrio commented Jun 29, 2016

SHELL Script

  1. if
#! /bin/bash

read -p "Please input your score: " a 
if ((a < 60)) ; then
    echo "You didn`t pass the exam."
else
    echo "good! You passed the exam."
fi
  1. elif
#! /bin/bash

read -p "Please input your score: " a 
if ((a < 60)) ; then
    echo "You didn`t pass the exam."
elif ((a > 60)) && ((a < 85)); then
    echo "Good! You passed the exam."
else
    echo "Very good! Your score is very high!"
fi

-lt ( < )(小于),-gt ( > )(大于),-le ( <= )(小于等于),-ge ( => )(大于等于),-eq ( = )(等于),-ne ( != )(不等于)

@linrio
Copy link
Owner Author

linrio commented Jun 29, 2016

for and while

1.makelll.shfile
2.chmod +x lll.sh

1.for

#! /bin/bash

for i in $(seq 6 10);
do
        echo $i
done

2.while

#! /bin/bash

a=10
while [ "$a" -ge 0 ];
do
        echo "$a"
        a=$[$a-1]
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant