Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 11-17-2004, 11:48 AM   #1
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


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, 12:14 PM   #2
LQ Guru
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Linux Mint 17, Debian 8
Posts: 7,865

Rep: Reputation: 311Reputation: 311Reputation: 311Reputation: 311
"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:

Steve Stites


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 08:09 AM
easy script question citrus Linux - Newbie 7 03-23-2005 04:58 PM
Bash script!! need help!!!!!could be easy! yulitao Programming 3 03-25-2004 07:52 PM
Easy bash script question TheRealDeal Linux - General 11 08-26-2003 10:45 PM
Easy script question. TheRealDeal Linux - General 2 08-22-2003 12:51 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:20 PM.

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