This probably doesn't answer the mail question but here is some more info on the startup files.
Are you searching for the files in Finder? Make sure that you are searching from a terminal and using ls -A
so that hidden files (files beginning with a '.
') show up.
The following is from the Bash Reference Guide. It describes the startup files that are executed when you start a new terminal window in OS X (which is an interactive, login shell).
6.2 Bash Startup Files
This section describes how Bash executes its startup files. If any of the files exist but cannot be read, Bash reports an error. Tildes are expanded in file names as described above under Tilde Expansion (see Section 3.5.2 [Tilde Expansion], page 19).
Interactive shells are described in Section 6.3 [Interactive Shells], page 75.
Invoked as an interactive login shell, or with ‘--login’
When Bash is invoked as an interactive login shell, or as a non-interactive shell with the --login
option, it first reads and executes commands from the file /etc/profile
, if that file exists. After reading that file, it looks for ~/.bash_profile
, ~/.bash_login
, and ~/.profile
, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile
option may be used when the shell is started to inhibit this behavior.
When a login shell exits, Bash reads and executes commands from the file ‘~/.bash_logout’, if it exists.
Best Answer
System Information is a GUI for the CLI system_profiler. It's read directly from whatever
system_profiler
spits out. All the work is already done for you (system_profiler
reads from many different files and executables):!Just saw an answer posted. See @XAleXOwnZX for the exact command.
To compile that into a script within Terminal, enter text as follows. Return is supported for newlines after
cat
command.njboot$ cat > cycle
#! /bin/bash
#Output is current cycle count of the battery
system_profiler SPPowerDataType | grep "Cycle Count" | awk '{print $3}'
Now, you have the script. Press Control+D within terminal for a carriage return:
Make executable:
njboot$ chmod +x cycle
njboot$ ./cycle 64
Optional:
njboot$ mv cycle ~/bin/
njboot$ cycle 64
Addendum: Again, credit to XAleXOwnZX for the exact command