Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 15th, 2005, 7:12 PM   #1
magyarkid
Newbie
 
Join Date: Jan 2005
Location: Virginia USA
Posts: 6
Rep Power: 0 magyarkid is on a distinguished road
Send a message via AIM to magyarkid
Help Me!!

HEEELLLLPPPP!!!!
I've been developing a basic suite of apps to get to know Shell Scripting in Fedora 1 Linux. I have 2 applications done and bug-free, but my third is no... here is the code:
#-------------Credits------------
# (C) 2005 Kid Kompany
# Written by Chris Szentkiralyi
# v1.5
#--------------------------------
#!/bin/sh

makeDir() {
	if mkdir "_$dir"
	then
		echo "Directory _$dir created..."
	else
		echo "ERROR: Directory could not be created"
	fi
}
changeDir() {
	if cd "_$dir"
	then
		echo "Directory changed to $dir"
	else
		ECHO "ERROR: Directory could not be changed"
	fi
}
copyFiles() {
	if cp *.* _$dir
	then
		echo "Files copied to _$dir"
	else
		echo "ERROR: Could not copy files to _$dir"
	fi
}
read dir
makeDir
changeDir
copyFiles
The problem is that I can't seem to get the copyFiles() function to work right. It won't let me use '*.*' to copy all of the files... and I am out of ideas. PLEASE HELP!!!
__________________
Signed,
Magyarkid
magyarkid is offline   Reply With Quote
Old Feb 15th, 2005, 7:40 PM   #2
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,667
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
just try a * and not *.* not all files in linux have a ext so just do the *
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is offline   Reply With Quote
Old Feb 16th, 2005, 7:43 AM   #3
magyarkid
Newbie
 
Join Date: Jan 2005
Location: Virginia USA
Posts: 6
Rep Power: 0 magyarkid is on a distinguished road
Send a message via AIM to magyarkid
Oh... but this is an all-perpouse utitlity... so what happens if it ran into, say, 'file.ext'? Would the * work for that? Or would it have to be *.*?
__________________
Signed,
Magyarkid
magyarkid is offline   Reply With Quote
Old Feb 16th, 2005, 9:20 AM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
It works whether or not the file has an extension. Go for it.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Feb 17th, 2005, 7:36 AM   #5
magyarkid
Newbie
 
Join Date: Jan 2005
Location: Virginia USA
Posts: 6
Rep Power: 0 magyarkid is on a distinguished road
Send a message via AIM to magyarkid
OK. Thanks, Ooble and big_k105!

NOTE: I can't edit my first post to add [solved]... the EDIT buttons are on my other posts, but not the first one...
__________________
Signed,
Magyarkid

Last edited by magyarkid; Feb 17th, 2005 at 7:41 AM.
magyarkid is offline   Reply With Quote
Old Feb 17th, 2005, 4:33 PM   #6
magyarkid
Newbie
 
Join Date: Jan 2005
Location: Virginia USA
Posts: 6
Rep Power: 0 magyarkid is on a distinguished road
Send a message via AIM to magyarkid
Exclamation Arggggg

Great.... the files were copied... and it works. But it still gives me this:
cp: cannot stat `*': No such file or directory
Like I said... the utility works, but an error is still displayed.
__________________
Signed,
Magyarkid
magyarkid is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:57 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC