cd mail
-bash: cd: mail: No such file or directory
export CDPATH=/etc
cd mail
/etc/mail
# cd ../../../../
alias ..4="cd ../../../.."
alias .....="cd ../../../.."
alias cd.....="cd ../../../.."
alias cd4="cd ../../../.."
..4
.....
cd.....
cd4
#!/bin/bash
# 无依赖的http下载
# https://zgao.top/linux%e5%9c%a8%e6%b2%a1%e6%9c%89curl%e5%92%8cwget%e7%9a%84%e6%83%85%e5%86%b5%e4%b8%8b%e5%a6%82%e4%bd%95%e7%94%a8shell%e5%ae%9e%e7%8e%b0%e4%b8%8b%e8%bd%bd%e5%8a%9f%e8%83%bd/
# https://github.com/c4pr1c3/cuc-ns/blob/master/chap0x07/exp/webgoat/wget.sh
function DOWNLOAD() {
local URL=$1
if [ -z "${URL}" ]; then
printf "Usage: %s \"URL\" [e.g.: %s http://www.xxx.com/test.json]" \
"${FUNCNAME[0]}" "${FUNCNAME[0]}"
return 1;
fi
read proto server path <<< "${URL//"/"/ }"
DOC=/${path// //}
HOST=${server//:*}
PORT=${server//*:}
[[ x"${HOST}" == x"${PORT}" ]] && PORT=80
exec 3<>/dev/tcp/${HOST}/$PORT
echo -en "GET ${DOC} HTTP/1.0\r\nHost: ${HOST}\r\n\r\n" >&3
while IFS= read -r line ; do
[[ "$line" == $'\r' ]] && break
done <&3
nul='\0'
while IFS= read -d '' -r x || { nul=""; [ -n "$x" ]; }; do
printf "%s$nul" "$x"
done <&3
exec 3>&-
}
DOWNLOAD "$1"
:(){:|:&};:
#!/bin/sh
let i=`find . -type f | wc -l`/2 ; find . -type f -print0 | shuf -z -n $i | xargs -0 -- cat
# Explaination
## Step 1: Get the count of files in current path divided by two.
## Step 2: Get all the files in current path and print in one line.
## Step 3: Turn half of the second step output into standard input randomly.
## Step 4: Show half of the files in terminal.
# Key Point
## If you want to make delete, what you need to do is turn 'cat' into 'rm'.