>>苹果系统显示隐藏文件切换脚本


初用苹果机,各种不习惯。幸好和Linux有几分相似。但是操作上差别就大了去了。因为经常需要操作隐藏文件,又不想整天看到一大堆带点的文件,所 以写了个小脚本,无聊之作,勿喷。用的还是Bash。我感觉应该有办法做个直接点击就能进行互相切换的操作,比如给Finder加个什么操作?下次研究出 来了再说。先放代码:

#!/bin/bash
# hideshow.sh
if [ $# -lt 1 ];then
	echo "usage hideshow.sh hide|show"
	exit
fi
case $1 in
show)
	if [ `defaults read com.apple.finder AppleShowAllFiles` = "1" ];then
		echo "Hide files already been shown, did nothing!"
		exit
	else
		defaults write com.apple.finder AppleShowAllFiles -bool true
		killall Finder
		exit
	fi
	;;
hide)
	if [ `defaults read com.apple.finder AppleShowAllFiles` = "0" ];then
		echo "Dot Files already been hided, did nothing!"
		exit
	else
		defaults write com.apple.finder AppleShowAllFiles -bool false
		killall Finder
		exit
	fi
	;;
*)
	echo "usage hideshow.sh hide|show"
	;;
esac

此条目发表在 Shell 分类目录,贴了 , , , , , 标签。将固定链接加入收藏夹。

相关日志:

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

注意: 评论者允许使用'@user:'的方式将自己的评论通知另外评论者。例如, ABC是本文的评论者之一,则使用'@ABC:'(不包括单引号)将会自动将您的评论发送给ABC。请务必注意user必须和评论者名相匹配(大小写一致)。