Exclamation ‘!’ in shell

Generally “!” is used in shell to invoke a previous event.

(eg.)
$ ls
(some o/p is displayed)

$ ls -l
(some other o/p is displayed)

Now,
$ !ls
(same o/p as ls -l, since this was the previous event for “ls”).

This is the general behaviour of ! in shell.

Now, for one of my works I wanted to send the password via command line and say, my password was something like “password!1”, what would happen ???

eg.

$ svn ls <some url> –username name –password password!1

We get something like,

bash: !1: event not found

for obvious reasons that it is trying to invoke the previous event of “1” but I don’t have any.

So, how do we pass the password as “password!1” as such ?

$ svn ls <some url> –username name –password password’!1′

would solve the problem.😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s