Does "pmset schedule wake" work when the lid is closed at the designated time? I am using Air, which is in the sleep mode almost all day. I want to have it run a shell script every morning, so I set my Air to wake up at 7:00 using "pmset" command and run the script at 7:01 using another command. However, this does not work when the lid is closed and is unconnected to power at 7:00, and the script is not run until I wake it up by myself. 

Does "pmset schedule wake" work when the lid is closed and connected to power?
My understanding is no, because the act of having the lid closed is designed to put the Air to sleep (this is done with magnets). The only exception is closed clamshell mode where you need:


power connected
display connected
external keyboard + mouse or trackpad (bluetooth or USB)


You can watch the power events with pmset -g pslog so if you were to set a wake and then have terminal.app or other command line to watch the log, you could look at things when you wake up the Mac via lid open or external display. Power Nap would be the only way you might get some events run with the lid closed and not in clamshell mode.

Also, while I haven't tried doing what you're trying to, I have noticed that allowing 5 minutes for a scheduled wake event is usually a better way to go.

So you could try running the script a little later (e.g. 7:05), or perhaps setting the Air to wake at 6:56. However, as I stated above, the lid being closed means the magnet will trigger a sleep event.