diff --git a/cmd/geth/js.go b/cmd/geth/js.go
index 8ebb04bce6525f3e750d3c2ebc2dc61e5fe29d98..7f7f19d78aefb9c84932c3813b9fa54285c0d1d5 100644
--- a/cmd/geth/js.go
+++ b/cmd/geth/js.go
@@ -439,7 +439,7 @@ func (self *jsre) interactive() {
 func mustLogInHistory(input string) bool {
 	return len(input) == 0 ||
 		passwordRegexp.MatchString(input) ||
-		leadingSpace.MatchString(input)
+		!leadingSpace.MatchString(input)
 }
 
 func (self *jsre) withHistory(datadir string, op func(*os.File)) {