Categories

 

June 2008
M T W T F S S
« Apr   Jul »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

What I'm Doing...

PlaytimePriya and KunalIMG00015.jpgIMG00017.jpgFallColors.jpgSpring

Reuse previous arguments

Here is another great tip from IBM. I love this. The !$ command returns the last argument used with a command. But what happens if you have a command that used arguments and you want to reuse just one of them?

The !:1 operator returns the argument used in a command. The example in Listing 3 shows how you can use this operator in combination with the !$ operator. In the first command, a file is renamed to a more meaningful name, but to preserve use of the original file name, a symbolic link is created. The file kxp12.c is renamed in a more readable manner, then the link command is used to create a symbolic link back to the original file name, in case it’s still used elsewhere. The !$ operator returns the file_system_access.c argument, and the !:1 operator returns the kxp12.c argument, which is the first argument of the previous command.

$ mv kxp12.c file_system_access.c
$ ln –s !$ !:1

Share

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>