-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhidden.sh
executable file
·35 lines (35 loc) · 942 Bytes
/
hidden.sh
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
#!/bin/bash
#######################################################################
# hidden.sh
# Shows or hides hidden files on MacOS X Finder
# Version: 0.3
# Usage: hidden [on|off]
# on to hide files
# off to display hidden files.
# Changelog:
# 0.1 first version.
# 0.2 On/off style.
# 0.3 Change finder -> Finder, 0/1 -> FALSE/TRUE, improve feedback.
#######################################################################
hiddenwriter(){
defaults write com.apple.Finder AppleShowAllFiles $1
killall Finder
}
CURRENT=`defaults read com.apple.Finder AppleShowAllFiles`;
if [[ $BASH_ARGC < 0 ]]; then
if [[ $CURRENT == 'FALSE' ]]; then
echo 'on'
else
echo 'off'
fi
exit
fi
if [[ ($1 == 'off') && ($CURRENT == 'FALSE')]]; then
hiddenwriter TRUE
echo 'Hidden files are now visible'
elif [[ ($1 == 'on') && ($CURRENT == 'TRUE')]]; then
hiddenwriter FALSE
echo 'Hidden files not visible'
else
echo "Nothing changed"
fi