0

This is the goal:

cp file1 file1.bkup

I don't want to type file1 twice, what's the easiest way pls ? in bash or or shells.

Archemar
  • 31,183
  • 18
  • 69
  • 104
user3552178
  • 103
  • 2
  • Closely related: [How to repeat currently typed in parameter on bash console?](https://unix.stackexchange.com/questions/40128/how-to-repeat-currently-typed-in-parameter-on-bash-console) – steeldriver Apr 15 '21 at 02:00

1 Answers1

3

If you're using Bash or some other shells, you could use brace expansion:

cp file1{,.bkup}

This will expand to:

cp file1 file1.bkup
John Moon
  • 993
  • 5
  • 9
  • little bit complicated, wish there's a simpler syntax, but thx a lot ! – user3552178 Apr 15 '21 at 00:30
  • @user3552178 Good! If this solves your issue, please consider [accepting the answer](https://unix.stackexchange.com/help/someone-answers). Accepting an answer marks the issue as resolved. – Kusalananda Apr 20 '21 at 08:44