Skip to content

Commit

Permalink
更换了 hash 命令的使用
Browse files Browse the repository at this point in the history
  • Loading branch information
wxnacy committed Apr 4, 2019
1 parent 2cdb5ed commit 643151d
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 42 deletions.
58 changes: 55 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,30 @@
Wshell 是集成化的 Linux 服务器脚本,主旨是尽量将常用软件的复杂安装过程和操作一键化,提高工作效率。

**适配**
- MacOS
- Ubuntu
- Debian
- CentOS


## 安装

### MacOS

**安装**

```bash
$ brew tap wxnacy/tap && brew install wshell
```

**更新**

```bash
$ brew update && brew upgrade wshell
```

### Linux

**安装最新版**

安装前需要确保系统中已经安装 `curl, git, expect`
Expand All @@ -24,7 +41,6 @@ curl
$ curl -L https://raw.githubusercontent.com/wxnacy/wshell/master/wshell-installer | bash
```


**配置环境**


Expand All @@ -35,8 +51,20 @@ $ echo '. ${WS_HOME}/conf/system/bashrc' >> ~/.bashrc
$ source ~/.bashrc
```

**查看版本**

```bash
$ ws version
```

## 使用
**更新**

```bash
$ ws update
```


## 语法

```bash
$ ws[hell] <command> [args...]
Expand Down Expand Up @@ -64,7 +92,6 @@ $ wshell install java
- `htop`
- `http` httpie
- `wvim`
- `wcrypto`
- `ssr` 安装后会自动重启,随后登陆执行 `bash serverspeeder-all.sh` 安装加速服务
- `system`

Expand Down Expand Up @@ -93,3 +120,28 @@ c++, pcre, pcre-devel, openssl, openssl-devel, epel-release, zlib, zlib-devel, r
### os

查看系统版本信息

```bash
$ ws os
Darwin 10.14.3 brew
# 平台名称 版本号 使用包管理工具
```

### hash

计算 hash 值,可以传入字符串或者文件名

```bash
$ ws <md5|sha1|sha256|sha512> <text|filename>
```

**例子**

```bash
$ ws md5 wxnacy # 计算字符串
1f806eb48b670c40af49a3f764ba086f wxnacy
$ ws md5 README.md # 计算文件
cf4b95753d3382d3560b1ad4f068db01
$ cat README.md | ws md5 # 接收管道信息
cf4b95753d3382d3560b1ad4f068db01
```
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.4
1.4.5
13 changes: 9 additions & 4 deletions bin/base/ll
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

# echo `ls -l`

for i in `ls -l`
do
echo $i
done
# for i in `ls -lh`
# do
# echo $i
# done

# echo `ls -lh`

# `ls -lh`
# $(ls -lh)
10 changes: 8 additions & 2 deletions bin/base/md5
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/env bash
# !/usr/bin/env bash

echo `ws wcrypto md5 $1`
# msg=$1
# if [ -f $msg ]
# then
# echo `cat $msg | ws wcrypto md5`
# else
# echo `ws wcrypto md5 $msg`
# fi
2 changes: 1 addition & 1 deletion bin/base/sha1
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

echo `ws wcrypto sha1 $1`
# echo `ws wcrypto sha1 $1`
2 changes: 1 addition & 1 deletion bin/base/sha256
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

echo `ws wcrypto sha256 $1`
# echo `ws wcrypto sha256 $1`
2 changes: 1 addition & 1 deletion bin/base/sha512
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

echo `ws wcrypto sha512 $1`
# echo `ws wcrypto sha512 $1`
1 change: 0 additions & 1 deletion bin/base/zip
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ cmd=$1

case $1 in
'all')

for f in `ls`
do
test -f $f && zip $f.zip $f || zip -r $f.zip $f
Expand Down
53 changes: 27 additions & 26 deletions bin/wshell
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
# WS_HOME=${HOME}/.wshell
# VER_PATH="${WS_HOME}"/VERSION
# VERSION=`cat $VER_PATH`
CMD=$1
ARGS=($@)
# CMD=$1
# ARGS=($@)

OS=`${WS_HOME}/bin/base/os`
OSS=(${OS})
SYS=${OSS[0]}
VER=${OSS[1]}
# OS=`${WS_HOME}/bin/base/os`
# OSS=(${OS})
# SYS=${OSS[0]}
# VER=${OSS[1]}

help(){
echo "Wshell Version: $(version)"
echo "Your system are: ${OS}"
echo "Your system are: $($WS_HOME/bin/base/os)"
echo ''
echo 'Usage: wshell <command> [<args>]'
echo ''
Expand All @@ -36,37 +36,22 @@ help(){
# echo 'For full documentation, see: https://github.com/yyuu/pyenv#readme'
}


# install(){
# name=${2}
# SH=${0/%wshell/${1}/${name}}
# if [ -f $SH ];then
# $SH
# else
# SH=${0/%wshell/${name}/${1}}
# if [ -f $SH ];then
# $SH
# else
# help
# fi
# fi
# }

other(){
SH=$(ws home)/bin/$1/$2
ws_home=$(ws home)
SH=${ws_home}/bin/$1/$2
if [ -f $SH ];then
$SH $3 $4 $5 $6
exit
fi

SH=$(ws home)/bin/$2/$1
SH=${ws_home}/bin/$2/$1
if [ -f $SH ];then
$SH $3 $4 $5 $6
exit
fi

# SH=${0/%wshell/base\/$1}
SH=$(ws home)/bin/base/$1
SH=${ws_home}/bin/base/$1
if [ -f $SH ];then
$SH $2 $3 $4 $5 $6
exit
Expand All @@ -84,11 +69,27 @@ version() {
echo `cat $(ws home)/VERSION`
}

hash() {
msg=$2
if [ -f $msg ]
then
echo `cat $msg | ws wcrypto $1`
else
echo `ws wcrypto $1 $msg`
fi

}

case "$1" in
help) help;;
-h) help;;
-V) help;;
-v) version;;
version) version;;
md5) hash $1 $2;;
sha1) hash $1 $2;;
sha256) hash $1 $2;;
sha512) hash $1 $2;;
home) home;;
*) other $1 $2 $3 $4 $5 $6 $7;;
esac
Expand Down
4 changes: 2 additions & 2 deletions conf/bash/bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export PATH=$PATH:/Users/wxnacy/PycharmProjects/study/goland/bin
# for wshell
# export WS_HOME="${HOME}/.wshell"

export WS_HOME=$(brew --prefix wshell)
# export WS_HOME="${HOME}/.wshell"
# export WS_HOME=$(brew --prefix wshell)
export WS_HOME="${HOME}/.wshell"
export PATH=$PATH:${WS_HOME}/bin

# for image
Expand Down

0 comments on commit 643151d

Please sign in to comment.