Skip to content

Commit

Permalink
Update curl,date,declare
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Dec 18, 2018
1 parent 0df3c23 commit 7f69a6b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions command/curl.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ curl URL --silent
使用选项`-O`将下载的数据写入到文件,必须使用文件的绝对地址:

```
curl http://man.linuxde.net/text.iso --silent -O
curl http://wangchujiang.com/text.iso --silent -O
```

选项`-o`将下载数据写入到指定名称的文件中,并使用`--progress`显示进度条:

```
curl http://man.linuxde.net/test.iso -o filename.iso --progress
curl http://wangchujiang.com/test.iso -o filename.iso --progress
######################################### 100.0%
```

Expand All @@ -162,15 +162,15 @@ curl -C -URL
使用`--referer`选项指定参照页字符串:

```
curl --referer http://www.google.com http://man.linuxde.net
curl --referer http://www.google.com http://wangchujiang.com
```

**用curl设置cookies**

使用`--cookie "COKKIES"`选项来指定cookie,多个cookie使用分号分隔:

```
curl http://man.linuxde.net --cookie "user=root;pass=123456"
curl http://wangchujiang.com --cookie "user=root;pass=123456"
```

将cookie另存为一个文件,使用`--cookie-jar`选项:
Expand All @@ -191,7 +191,7 @@ curl URL -A "Mozilla/5.0"
其他HTTP头部信息也可以使用curl来发送,使用`-H`"头部信息" 传递多个头部信息,例如:

```
curl -H "Host:man.linuxde.net" -H "accept-language:zh-cn" URL
curl -H "Host:wangchujiang.com" -H "accept-language:zh-cn" URL
```

**curl的带宽控制和下载配额**
Expand All @@ -217,23 +217,23 @@ curl URL --max-filesize bytes
使用curl选项 -u 可以完成HTTP或者FTP的认证,可以指定密码,也可以不指定密码在后续操作中输入密码:

```
curl -u user:pwd http://man.linuxde.net
curl -u user http://man.linuxde.net
curl -u user:pwd http://wangchujiang.com
curl -u user http://wangchujiang.com
```

**只打印响应头部信息**

通过`-I`或者`-head`可以只打印出HTTP头部信息:

```
[root@localhost text]# curl -I http://man.linuxde.net
[root@localhost text]# curl -I http://wangchujiang.com
HTTP/1.1 200 OK
Server: nginx/1.2.5
date: Mon, 10 Dec 2012 09:24:34 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding
X-Pingback: http://man.linuxde.net/xmlrpc.php
X-Pingback: http://wangchujiang.com/xmlrpc.php
```

**get请求**
Expand Down
2 changes: 1 addition & 1 deletion command/date.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ date -s "20120523 01:01:01" //这样可以设置全部时间
#!/bin/bash
start=$(date +%s)
nmap man.linuxde.net &> /dev/null
nmap wangchujiang.com &> /dev/null
end=$(date +%s)
difference=$(( end - start ))
Expand Down
8 changes: 4 additions & 4 deletions command/declare.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare
===


声明或显示shell变量

## 补充说明
Expand Down Expand Up @@ -29,10 +29,10 @@ shell变量:声明shell变量,格式为“变量名=值”。

### 实例

首先使用declare命令定义shell变量"test",并且将其值设置为"man.linuxde.net",输入如下命令:
首先使用declare命令定义shell变量"test",并且将其值设置为"wangchujiang.com",输入如下命令:

```
declare test='man.linuxde.net' #定义并初始化shell变量
declare test='wangchujiang.com' #定义并初始化shell变量
```

上面的命令执行后,再使用echo命令将该shell变量值输出,输入如下命令:
Expand All @@ -44,7 +44,7 @@ echo $test #输出shell变量的值
上面的指令执行后,其输出的结果如下:

```
man.linuxde.net
wangchujiang.com
```


Expand Down

0 comments on commit 7f69a6b

Please sign in to comment.