OSDN Git Service

0200aba0af070c55e739d12ebe030b8d561d3012
[alterlinux/lsdcontrol.git] / lsd-control
1 #!/usr/bin/env bash
2
3
4 # Usage
5 # _usage <exit code>
6 _usage() {
7     echo "usage ${0} <true or false>"
8     echo
9     echo "Set the default behavior when the ls command is executed."
10     echo
11     echo "If true is passed, the ls alias will be set to lsd."
12     echo "If false is passed, no ls alias will be set."
13
14     exit "${1}"
15 }
16
17
18 if [[ ! ${#} = 1 ]]; then
19     _usage 1
20 fi
21
22
23 case ${1} in
24     true) lsd=true ;;
25     false) lsd=false ;;
26     *) _usage 1 ;;
27 esac
28
29
30 echo -ne "lsd=${lsd}" > ~/.lsd-control