Results 1 to 10 of 10
How can i delete the following three files “abc1.dat”, “abc2.txt”, and “abc3.bat”
but not “abc4.tex” (Note: use only one shell command)...
- 10-23-2007 #1Just Joined!
- Join Date
- Oct 2007
- Posts
- 5
deleting files on shell
How can i delete the following three files “abc1.dat”, “abc2.txt”, and “abc3.bat”
but not “abc4.tex” (Note: use only one shell command)
- 10-23-2007 #2
Homework?

Or better (assuming bash):Code:rm abc[1-3].[bdt][ax]t
The first example will remove abc.bxt, abc.dxt and abc.tat alsoCode:shopt -s extglob rm abc[1-3].@([bd]at|txt)
- 10-25-2007 #3
This sounds a bit like a homework question, which we're not allowed to answer.
I will say, however, that most commands take in a list of arguments, rather than just a single one. This is often indicated in a man page by "...". For instance, if we run "man rm", we see this at the top:
This means that rm takes in any number of (optional) options, followed by any number of files.Code:SYNOPSIS rm [OPTION]... FILE...
I suggest you consider how to use this.DISTRO=Arch
Registered Linux User #388732
- 10-25-2007 #4Just Joined!
- Join Date
- Oct 2007
- Posts
- 5
my command is
rm -ri abc*
but i this command is not true because i must do it in one command this is my problem
***
shopt -s extglob
rm abc[1-3].@([bd]at|txt)
****
rm abc[1-3].[bdt][ax]t
couldn't run these with ssh
- 10-25-2007 #5Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
- 10-26-2007 #6Just Joined!
- Join Date
- Oct 2007
- Posts
- 5
i acces our teachers machine via ssh, i solve my problem rm abc[1-3]* command,
i tried o say, i must use and run simply bash command because i am really new linux user and programmer
- 10-26-2007 #7Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
Are you using the BASH shell when you login via ssh? I don't really understand you. Is this now working?
- 10-26-2007 #8Just Joined!
- Join Date
- Oct 2007
- Posts
- 5
yes, bash shell
(i said again i am extremelly new about linux)
- 10-26-2007 #9Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
If these commands are not working, can you post back the errors you are getting?
- 10-26-2007 #10Just Joined!
- Join Date
- Oct 2007
- Posts
- 5
sorry i have tried again and i see both of the commands run succesfully!


Reply With Quote
