LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-17-2004, 10:48 AM   #1
skibud2
Member
 
Registered: Sep 2003
Location: Waltham MA
Distribution: Mandriva 2007 w/ KDE
Posts: 87

Rep: Reputation: 15
Easy Bash Script Question


I want to run:

rm *~ (I am trying to remove files like test.c~)

from a bash script. However, the script is not finding the files. I am assuming that the bash script interprets the wildcharacter * differently than the shell environment.

Thank you in advance for the help

-Mike

PS I did try to search for topics that cover this basic information but did not find anything useful. I am open to suggestions of websites to visit.
 
Old 11-17-2004, 11:14 AM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
"However, the script is not finding the files."

You may not be telling rm to look in the right directories. You might have to cd to the right directory before you issue rm. You may need the -R option on the rm command. See man rm.

If your search criteria is too complicated for a simple * you could some variation of this command:
find /home/user/* -iname "*.~" -exec rm {} \;
You can find an explanation of what this means here:

http://www.linuxquestions.org/questi...hreadid=167901

-------------------------
Steve Stites
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy Shell Script Question scriptn00b Linux - Newbie 8 09-04-2005 07:09 AM
easy script question citrus Linux - Newbie 7 03-23-2005 03:58 PM
Bash script!! need help!!!!!could be easy! yulitao Programming 3 03-25-2004 06:52 PM
Easy bash script question TheRealDeal Linux - General 11 08-26-2003 09:45 PM
Easy script question. TheRealDeal Linux - General 2 08-21-2003 11:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration