Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

In a single command how do you run the previous command in
the command prompt.

Answer Posted / joker

!! will execute the last command
!-1 will execute the 2nd command from last

Few other tricks:
-----------------

If you are not sure you can see what is the command rather than executing by

!!:p
!-2:p

and later just do !!

If you want to run the last command with little modification use substitution

!!:s/old/new

example:

>vim test
>!!:s/test/abcd/:p
vim abcd

Thanks,
Joker

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can any user find out all information about a specific user like his default shell, real-life name, default directory, when and how long he has been using the system?

1053


How are shells born?

908


How to calculate the number of passed arguments?

997


What makes c shell a more preferable option than the bourne shell?

912


What are the advantages of using shell scripts?

1012


Write down the syntax of "for " loop

1032


Explain about login shell?

1051


How will you copy a file from one machine to other?

944


What is a shell environment?

937


Explain about sourcing commands?

1029


How would you compare the strings in a shell script?

929


Determine the output of the following command: [ -z “” ] && echo 0 || echo 1

944


Explain about return code?

1014


What is the difference between bash and shell?

1058


Tell something about the super block in shell scripting?

972