1. Đề bài
– Bài tập shell script, nhập 1 chuỗi tên của 1 file trên hệ thống hoặc set quy định biến với file tên. Xóa phần extension mở rộng tên file (nếu có extension) với dấu ngăn cách phần mở rộng là kí tự ‘.’ . Nếu file name không có phần extension thì báo không có.
2. Ví dụ
Input = ‘backup_full.2016-06-01.sql’
Output = ‘backup_full.2016-06-01’
Input = ‘lady_gaga.mp3’
Output = ‘lady_gaga’
Input = ‘backup_full2016-06-01txt’
Output = ‘backup_full2016-06-01txt’
– No extension name of file.
3. Nội dung code
Link ‘glot.io’ : https://glot.io/snippets/eimk2oh49q
Link ‘cuongquach.com’ : https://cuongquach.com/download/shellscripts/excersie/delete_ext_filename.sh.txt
Cám ơn đã theo dõi.