1

I do this in BASH

echo test "$1" 

..expecting to get..

test test 

..but I get..

test 

Is this something possible to do? It would make my life easier since having a list files I could do something like mv a/b/test.py proj_copy/$1

1
  • 1
    echo test{,} ? Commented Jun 24, 2016 at 10:52

1 Answer 1

4

You can use history expansion

$ echo test !#:^ echo test test test test $ echo a/b/test.py proj_copy/!#:^ echo a/b/test.py proj_copy/a/b/test.py a/b/test.py proj_copy/a/b/test.py 

!#
The entire command line typed so far.

:^
The first argument


You could also use brace expansion

$echo test{,} test test $echo {,proj_copy}/a/b/test.py /a/b/test.py proj_copy/a/b/test.py 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.