Shell Tips

help tips

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

help(){
cat << HELP
usage: dd ddk
example: 'wowo wowo'
HELP
exit 0
}

if [[ $1 == "" || $1 == "-h" ]]; then
echo 'what?'
help
fi

if [[ $1 != "" ]]; then
echo $1
fi

echo -e "\033]0;$1\007"

read from terminal

1
2
3
echo input your name:
read name
echo your name is ${name}