---
title: "แบ็กอัปไฟล์ด้วยชื่อเดิม + ส่วนต่อท้าย"
description: "หมายเหตุ: จริง ๆ แล้วคุณใช้ !#:1 ได้กับทุกคำสั่ง เพราะมันคือ argument สุดท้ายที่ส่งให้คำสั่งนั้น"
canonical: https://oozou.com/til/back-up-a-file-with-same-name-prefix-42
locale: th
date: 2020-10-13
topic: shell
---

# แบ็กอัปไฟล์ด้วยชื่อเดิม + ส่วนต่อท้าย

> หมายเหตุ: จริง ๆ แล้วคุณใช้ !#:1 ได้กับทุกคำสั่ง เพราะมันคือ argument สุดท้ายที่ส่งให้คำสั่งนั้น

Published: 2020-10-13 · Topic: [shell](https://oozou.com/th/til-topics/shell) ([markdown](https://oozou.com/th/til-topics/shell.md))

```shell
$ cp todo.txt !#:1.bak
cp todo.txt todo.txt.bak
```

หมายเหตุ: จริง ๆ แล้วคุณใช้ *!#:1* ได้กับทุกคำสั่ง เพราะมันคือ argument สุดท้ายที่ส่งให้คำสั่งนั้น

อัปเดต: ตอนนี้ใช้ได้กับ zsh แล้ว

---

Contact OOZOU: hello@oozou.com · +66 2544 0000 · https://oozou.com/th/contact

More for AI agents: https://oozou.com/llms.txt · every page has a markdown twin at its URL plus ".md"
