-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_sample.sh
More file actions
60 lines (50 loc) · 1.54 KB
/
test_sample.sh
File metadata and controls
60 lines (50 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
[[ -s ~/.bashrc ]] && source ~/.bashrc
#alfred; command:ll; parameters: none; description: list folder
alias ll='ls -alh'
# Preferred 'less' implementation
# Implement with FSRXc
alias less='less -FSRXc'
alias mkdir='mkdir -pv' # Preferred 'mkdir' implementation
alias alfred_help='echo "This is a alfred help message"' #alias comment
trash () { command mv "$@" ~/.Trash ; } # trash: Moves a file to the MacOS trash
# -----------------------------
# NOT Function comment
# -----------------------------
# Count of non-hidden files in current dir
# parameters: none | path
# $1 is the directory to count
numFiles(){
cd "$1" || return
echo $(ls -1 | wc -l)
}
# Opens any file in MacOS Quicklook Preview
# parameters: file
ql () { qlmanage -p "$*" >& /dev/null; }
## alfred reserve keywords ##
#alfred; command:killp; parameters:port number; description: kill process with given port number
killp(){
pid=$(lsof -i:"$1" | grep LISTEN | awk '{print $2}')
if [[ -z "$pid" ]]
then
echo "No found any process with port $1"
else
kill -9 "$pid"
echo "Killed process $pid"
fi
}
#alfred; command:vg; parameters:up| destroy| halt| ssh; description: vagrant command on homestead
function vg() {
cd ~/Homestead || exit
vagrant "$*"
}
#alfred; command:cl; parameters:path; description: cd to path and ls
function cl() {
DIR="$*";
# if no DIR given, go home
if [[ $# -lt 1 ]]; then
DIR=$HOME;
fi;
builtin cd "${DIR}" && \
# use your preferred ls command
ls -alh
}