how I can use the second argument of previous command in a new command ?
example, with
$ mkdir test
I make a directory, how I can use the name of directory for change to this ?
$ mkdir test && cd use_var
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
With history expansion, you can refer to arbitrary words in the current command line
!#refers to the line typed so far, and:1refers to word number one (withmkdirstarting at 0).If you use this in a script (i.e., a non-interactive shell), you need to turn history expansion on with
set -Handset -o history.