OS/macOS

[OS/macOS] 맥북 덮어도 화면 안꺼지게하는 명령어

bbugge 2022. 7. 7. 14:32

/usr/bin or /usr/local/bin 에 실행권한 주고 넣어서 사용 

# /bin/bash 
# pm
COMMAND=$1
if [ -z "$COMMAND" ];
then
echo "Please input [on/off/stat/show] at first variable";
else
if [ "on" == "$COMMAND" ];
then
sudo pmset -c disablesleep 0;
elif [ "off" == "$COMMAND" ];
then
sudo pmset -c disablesleep 1;
elif [ "stat" == "$COMMAND" ];
then
export SLEEP_STAT=`pmset -g | grep SleepDisabled | awk '{printf $2}'`;
if [ "1" -eq "$SLEEP_STAT" ];
then
echo "STATUS : sleep off";
else
echo "STATUS : sleep on";
fi
elif [ "show" == "$COMMAND" ];
then
pmset -g

else
echo "Please input [on/off/stat/show] at first variable";
fi
fi