![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| what is wrong with this tr -d? | cleansing_flame | UNIX for Dummies Questions & Answers | 3 | 02-06-2008 08:34 AM |
| What’s wrong with the following? | vrn | UNIX for Dummies Questions & Answers | 8 | 03-19-2006 05:09 PM |
| where have i gone wrong? | Blip | Shell Programming and Scripting | 3 | 01-28-2004 12:43 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
What am I doing wrong?
I really just mess around in UNIX, for the most part, when I want to get something done. I can usually piece things together by searching for brief how-to's on Google, but the syntax errors in my following .sh file are really confusing me. I've got lots of programming experience in other places, so geek-speak is fine.
If you can't tell what my code is supposed to do, I can explain it, but I feel (even with my errors) it should be clear. Oh, and I am running this through the Terminal on Mac OS X. Code:
hommv_path="/Applications/Games/Heroes\ of\ Might\ and\ Magic\ V.app/" move_dir="~/Desktop/" maps_dir="Contents/Resources/transgaming/c_drive/Program\ Files/Ubisoft/Heroes\ of\ Might\ and\ Magic\ V/" total_dir=$hommv_path$maps_dir folder_name="Maps/" # #Creates the Maps directory if needed if [ -d $total_dir$folder_name ]; then echo "Maps folder found."; else cd $total_dir; mkdir $folder_name; echo "New folder $folder_name created in $total_dir."; fi # #Moves all .h5m files from the move_dir to the Maps folder cd $move_dir for file in *.h5m; do mv $file $total_dir$folder_name; echo "Map $file moved to $total_dir$folder_name"; done # echo "All maps moved successfully." Last edited by demonpants; 06-19-2007 at 09:57 AM. |
| Forum Sponsor | ||
|
|
|
|||
|
Quote:
2. Why do you have mixes of single quotes and double quotes? 3. for file in '*.h5m' would only copy a file called '*.h5m', you don't need those quotes. |
|
|||
|
1) I am moving, I messed up on the comment.
2) I have quote mixes left over from trying all different combinations of things to get it to work. So there is absolutely no difference? 3) I had the quotes there because this is where my error is being reported. Here is the error. Code:
/Users/eli/Desktop/HoMM V Map Mover.sh: line 28: syntax error near unexpected to'en ` 'Users/eli/Desktop/HoMM V Map Mover.sh: line 28: `for file in *.h5m; Code:
for file in *.h5m; |