As I wrote in my comment, there are some special characters needing extra care when working at the shell prompt (or in shell scripts). One of them is the $
sign, which usually indicates a variable. If that should be taken literally, you need to escape it (or enclose the entire string by single quotes). Similar rules for quotation marks.
How your command should look like with an escaped $
, you can already find in eldarerathis' answer:
shell@android:/ # am start -n com.android.settings/.Settings\$PowerUsageSummaryActivity
Note the "back-slash" in front of the $
-- that's the escape sign. Use the same for quotation marks or blanks, if your command includes some to be taken literally, e.g.
myscript.sh first\ parameter\!
myscript.sh "first parameter!"
both would do the same: Making the string a single parameter. In the example of your am start
command, this is what happened on parsing:
- command:
am
- parameter 1:
start
- parameter 2:
-S
- parameter 3:
com.android.settings/.Settings$PowerUsageSummaryActivity
- has a
$
, interpreting: variable $PowerUsageSummaryActivity
is not set, so empty
- conclusion: parameter 3 is
com.android.settings/.Settings
Note also that if you run this directly via adb shell
, the command goes through shell parsing twice, so you need to escape or quote the command again, like this:
user@desktop:~$ adb shell am start -n 'com.android.settings/.Settings\$PowerUsageSummaryActivity'
'com.android.settings/.Settings$PowerUsageSummaryActivity'
-- or escaping the$
likecom.android.settings/.Settings\$PowerUsageSummaryActivity
-- which is the usual stuff to do on the shell when dealing with literal$
signs not indicating a variable?