GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — add scripts · Xu-Guo/python@972c8eb

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • scripts
    • checkfile.sh
    • file.sh
    • filename20150609
    • filename20150610
    • filename20150611
    • function.sh
    • hello.sh
    • param.sh
    • yesno.sh
  • webservice
    • server.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎scripts/checkfile.sh‎

Copy file name to clipboard
+27Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
# Program:
3+
# User input a filename, program will check the flowing:
4+
# 1.) exist? 2.) file/directory? 3.) file permissions
5+
# History:
6+
# 2005/08/25
7+
# VBird
8+
# First release
9+
# PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
10+
# export PATH
11+
# 1. 讥使用者输入档名,幵且刞断使用者是否真的有输入字符串?
12+
echo -e "Please input a filename, I will check the filename's type and \
13+
permission. \n\n"
14+
read -p "Input a filename : " filename
15+
test -z $filename && echo "You MUST input a filename." && exit 0
16+
# 2. 刞断档案是否存在?若丌存在则显示讯息幵结束脚本
17+
test ! -e $filename && echo "The filename '$filename' DO NOT exist" &&
18+
exit 0
19+
# 3. 开始刞断文件类型不属性
20+
test -f $filename && filetype="regulare file"
21+
test -d $filename && filetype="directory"
22+
test -r $filename && perm="readable"
23+
test -w $filename && perm="$perm writable"
24+
test -x $filename && perm="$perm executable"
25+
# 4. 开始输出信息!
26+
echo "The filename: $filename is a $filetype"
27+
echo "And the permissions are : $perm"
Collapse file

‎scripts/file.sh‎

Copy file name to clipboard
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
echo -e "I will use 'touch' command create 3 files"
3+
read -p "Please input your filename:"fileuser
4+
5+
filename=${fileuser:-"filename"}
6+
date1=$(date --date='2 days ago' +%Y%m%d)
7+
date2=$(date --date='1 days ago' +%Y%m%d)
8+
date3=$(date +%Y%m%d)
9+
file1=${filename}${date1}
10+
file2=${filename}${date2}
11+
file3=${filename}${date3}
12+
13+
touch ${file1}
14+
touch ${file2}
15+
touch ${file3}
Collapse file

‎scripts/filename20150609‎

Copy file name to clipboardExpand all lines: scripts/filename20150609
Whitespace-only changes.
Collapse file

‎scripts/filename20150610‎

Copy file name to clipboardExpand all lines: scripts/filename20150610
Whitespace-only changes.
Collapse file

‎scripts/filename20150611‎

Copy file name to clipboardExpand all lines: scripts/filename20150611
Whitespace-only changes.
Collapse file

‎scripts/function.sh‎

Copy file name to clipboard
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
function printit(){
3+
echo "Your choice is $1" # 这个 $1 必须要参考底下指令的下达
4+
}
5+
echo "This program will print your selection !"
6+
case $1 in
7+
"one")
8+
printit 1 # 请注意, printit 指令后面还有接参数!
9+
;;
10+
"two")
11+
printit 2
12+
echo "No problem"
13+
;;
14+
"three")
15+
printit 3
16+
;;
17+
*)
18+
echo "Usage $0 {one|two|three}"
19+
;;
20+
esac
Collapse file

‎scripts/hello.sh‎

Copy file name to clipboard
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
echo -e "Hello World! \a \n"
3+
exit 0
Collapse file

‎scripts/param.sh‎

Copy file name to clipboard
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
echo "The script name is ==> $0"
3+
echo "Total parameter number is ==> $#"
4+
[ "$#" -lt 2 ] && echo "The number of parameter is less than 2. Stop here." && exit 0
5+
echo "Your whole parameter is ==> '$@'"
6+
echo "The 1st parameter ==> $1"
7+
echo "The 2nd parameter ==> $2"
Collapse file

‎scripts/yesno.sh‎

Copy file name to clipboard
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
# Program:
3+
# This program shows the user's choice
4+
# History:
5+
# 2005/08/25
6+
# VBird
7+
# First release
8+
# PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
9+
# export PATH
10+
read -p "Please input (Y/N): " yn
11+
[ "$yn" == "Y" -o "$yn" == "y" ] && echo "OK, continue" && exit 0
12+
[ "$yn" == "N" -o "$yn" == "n" ] && echo "Oh, interrupt!" && exit 0
13+
echo "I don't know what your choice is" && exit 0
Collapse file

‎webservice/server.py‎

Copy file name to clipboard
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
import socket
4+
5+
HOST, PORT = '', 8899
6+
7+
listen_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
8+
listen_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
9+
listen_socket.bind((HOST, PORT))
10+
listen_socket.listen(1)
11+
print 'Serving HTTP on port %s ...' % PORT
12+
while True:
13+
client_connection, client_address = listen_socket.accept()
14+
request = client_connection.recv(1024)
15+
print request
16+
17+
http_response = """
18+
HTTP/1.1 200 OK
19+
20+
Hello, World!
21+
"""
22+
client_connection.sendall(http_response)
23+
client_connection.close()

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.