Sponsored Content
Full Discussion: First Script Syntax Error
Top Forums Shell Programming and Scripting First Script Syntax Error Post 302948297 by D351 on Sunday 28th of June 2015 01:15:47 PM
Old 06-28-2015
Error First Script Syntax Error

So, I'm writing my first shell script to try to speed up the process of creating lyric files for mocp and I don't know what the error is, but considering how short the code is, I'm betting it's something super-obvious.
line 7: syntax error near unexpected token `echo'
line 7: ` echo "${song%%*(.mp3)}"'
Code:
#!/bin/bash
#This will create blank lyric files, as used by mocp, for all mp3s in a direcory

files=(ls *.mp3)
for song in $files
 echo "${song%%*(.mp3)}"
 touch "${song%%*(.mp3)}"
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Syntax error in a script...

Hi All, I have been fighting with a syntax error for the last 2 days, still haven't got the solution. Could you please help me, your help will be greatly appreciated. In my script I am getting a error in a for loop, its similar to the one as is below. for v_id in v1 v2 v3 v4 do... (8 Replies)
Discussion started by: rajus19
8 Replies

2. Shell Programming and Scripting

syntax error in script !!

./disk_space_util.sh ./disk_space_util.sh: Syntax error at line 24 : `then' is not expected. ================================= cat disk_space_util.sh #!/bin/sh # # Parameter Settings ORA_LOG, ORA_SCRIPT, DBA_EMAIL_LIST -- (Set in .profile) bdf | sed "s/%/ /g" | sed "/Filesystem/d" |... (13 Replies)
Discussion started by: uuser
13 Replies

3. Shell Programming and Scripting

Syntax error in script

I get this error when I try to run my script (BTW, this is a simple script I am supposed to write for my class) $ menuscript menuscript: syntax error at line 89 : `"' unmatched $ Here is the code (Any help is greatly appreciated) (Line numbers included) 1 #!/bin/ksh 2 ... (2 Replies)
Discussion started by: KindHead
2 Replies

4. UNIX for Dummies Questions & Answers

awk Shell Script error : "Syntax Error : `Split' unexpected

hi there i write one awk script file in shell programing the code is related to dd/mm/yy to month, day year format but i get an error please can anybody help me out in this problem ?????? i give my code here including error awk ` # date-month -- convert mm/dd/yy to month day,... (2 Replies)
Discussion started by: Herry
2 Replies

5. Shell Programming and Scripting

Syntax error with a script

Hi I not sure what is wrong with my script... when I try to run it I get the follow error: "remove: syntax error at line 77: `end of file' unexpected" Thanks in advance for any help. ans=y while do while : do echo "Please enter a name that you... (3 Replies)
Discussion started by: simpsonjr
3 Replies

6. Shell Programming and Scripting

Syntax error in script

Hey guys keep having problems with the below script syntax error near unpexpected token '0' exit 0 I have two directorys backups and Usr in the usr i have sub dir's wp,ss,pic which i would like to back up (copy those directorys to the backups directory) with user acknowledgement from command line.... (2 Replies)
Discussion started by: Spartukus
2 Replies

7. Shell Programming and Scripting

Syntax error calling TCL script from shell script

hello everyone i am beginner on shell scripting .and i am working on my project work on ad hoc network i wrote a batch (.sh) to do a looping and execute a tcl script i wrote before in each iteration ..but i got this problem " syntax error near unexpected token `('... (1 Reply)
Discussion started by: marcoss90
1 Replies

8. Shell Programming and Scripting

Syntax Error in Script

Hi All, I am new to Unix, I have written the following script in ksh and get a syntax error :wall:. I need some help to figure out the error and reason. The script below uses some variables from an environment file, also it executes a sql file. The sql file is correct and has no problems. I... (1 Reply)
Discussion started by: disshort23
1 Replies

9. UNIX for Dummies Questions & Answers

Syntax Error Script

Hi guys i'd like to show you this code of my script, where i couldn't find this error " #! /bin/bash #copiabin.sh: copia todos los archivos ejecutables a bin if then mkdir $HOME/bin fi # copia de archivos y contador N N=0 for ARCH in * do if # Si el archivo es... (9 Replies)
Discussion started by: Newer
9 Replies

10. UNIX for Beginners Questions & Answers

Syntax error on script

Evening All (or morning for some), Could anyone have a look at the below and advise where i've going wrong with the syntax as i keep getting the below error while trying to run. Any help would be really apprecaited. ./testout: line 13: syntax error near unexpected token `else' ... (4 Replies)
Discussion started by: mutley2202
4 Replies
ID3REN(1)						      General Commands Manual							 ID3REN(1)

NAME
id3ren - Reads and writes ID3 tags from mp3 files. SYNOPSIS
id3ren [-help] [-song=SONG_NAME] [-artist=ARTIST_NAME] [-album=ALBUM_NAME] [-year=YEAR] [-genre={# | GENRE}] [-comment=COMMENT] [-track=TRACK] [-showgen] [-searchgen={# | GENRE}] [-default=DEFAULT] [-copytagfrom=FILE [-copysong] [-copyartist] [-copyalbum] [-copyyear] [-copygenre] [-copycomment] [-copytrack] [-copyall] ] [-quick] [-noalbum] [-nocomment] [-noyear] [-nogenre] [-notrack] [-tag] [-edit] [-notagprompt | -showtag | -striptag | -tagonly] [-nocfg] [-log] [-quiet] [-verbose] [-defcase | -lower | -upper] [-remchar=CHARS] [-repchar=CHARS] [-space=STRING] [-tagfromfilename | -tagffn] [-tagtemplate=TAGTEMPLATE] [-template=TEMPLATE] [FILE1 FILE2.. | WILDCARDS] COPYRIGHT
id3 Renamer (C) Copyright 1998 by Robert Alto (badcrc@tscnet.com) (C) Copyright 2001 Christophe Bothamy (cbothamy@free.fr) DESCRIPTION
id3ren is used to rename batches of mp3 files by reading the ID3 tag at the end of the file which contains the song name, artist, album, year, and a comment. The secondary function of id3ren is a tagger, which can create, modify, or remove ID3 tags. OPTIONS -album ALBUM_NAME Sets the album name to use when tagging files. All files will be tagged with this album name without prompting. -album=ALBUM_NAME Sets the album name to use when tagging files. All files will be tagged with this album name without prompting. -artist=ARTIST_NAME Sets the artist name to use when tagging files. All files will be tagged with this artist name without prompting. -comment=COMMENT Sets the comment to use when tagging files. All files will be tagged with this comment without prompting. -copyalbum Copies the album field from the source file tag set by -copytagfrom -copyall Copies all the fields from the source file tag set by -copytagfrom -copyartist Copies the artist field from the source file tag set by -copytagfrom -copycomment Copies the comment field from the source file tag set by -copytagfrom -copygenre Copies the genre field from the source file tag set by -copytagfrom -copysong Copies the song field from the source file tag set by -copytagfrom -copytagfrom=FILE Sets the filename to copy tag field from. -copytrack Copies the track field from the source file tag set by -copytagfrom -copyyear Copies the year field from the source file tag set by -copytagfrom -defcase Use the default case of characters from the ID3 tag when renaming files. This is default. -default=DEFAULT Sets the default field to be used only when renaming if a field is blank. Useful when renaming and creating "unknown" subdirecto- ries. Defaults to "unknown". -edit If a file already has a tag and you want to change just one specific field of the tag, use this option in conjunction with -tag and the option for the field you want to change. For example to change just the album name of a file: id3ren -tag -edit -album="New Album Name" sample.mp3 * This option is a toggle. -genre=# | GENRE_NAME Sets the genre to use when tagging files. All files will be tagged with this genre without prompting. To see a list of allowable genres use the -showgen argument. -genre accepts either the number of the genre as displayed with -showgen, or the name of the genre. -help Displays the help screen. -log Log most output to id3ren.log. * This option is a toggle. -lower Convert file names to lowercase characters. -noalbum Don't prompt for the album when adding a tag. * This option is a toggle. -nocfg Don't try reading any config files, even if they exist. * This option is a toggle. -nocomment Don't prompt for a comment when adding a tag. * This option is a toggle. -nogenre Don't prompt for a genre when adding a tag. * This option is a toggle. -notagprompt Never prompt for tag information. Files without tags are skipped. * This option is a toggle. -notrack Don't prompt for the track number when adding a tag. * This option is a toggle. -noyear Don't prompt for the year when adding a tag. * This option is a toggle. -quick Automatically sets -noalbum, -nocomment, and -noyear. -quiet Run quietly, displaying only errors or prompts. * This option is a toggle. -remchar=CHARS CHARS indicates a string of characters that will be removed from the filename if found. -repchar=CHARS CHARS indicates a string of characters, EACH followed by the character to replace it with. For example, to replace all plus '+' signs with a hyphen all '&' with '_', you would use '-repchar +-&_'. -searchgen=# | GENRE Searches the list of genres and displays either the genre name corresponding to #, or shows all substring matches of GENRE. -showgen Displays all the music genres currently in the program. -showtag Display the tags for the specified files. No renaming is performed. -song=SONG_NAME Sets the song name to use when tagging files. All files will be tagged with this song name without prompting. -space=PSTRING Change all spaces in the renamed file to STRING. To remove all spaces, use -striptag Remove the tags for the specified files. * This option is a toggle. -tag Always ask for a tag, even if the file already has one. * This option is a toggle. -tagfromfilename, -tagffn Use informations from the filename when tagging. See tagtemplate. * This option is a toggle. -tagonly Don't rename any files, just ask for tag information. Note that -tagonly only asks for tag information on files that don't have a tag already. To have it ask for a tag on all files, use with -tag. * This option is a toggle. -tagtemplate=TEMPLATE Use TEMPLATE as the basis for tagging files. The default template used is '[%a]-[%s].mp3'. Identifiers that can be used in the template are: %a - Artist name %c - Comment %s - Song name %t - Album title %n - Track Number %y - Year %g - Genre %d - Dummy It is a VERY good idea to have fixed separators between fields. -template=TEMPLATE Use TEMPLATE as the basis for renaming files. The default template used is '[%a]-[%s].mp3'. Identifiers that can be used in the template are: %a - Artist name %c - Comment %s - Song name %t - Album title %n - Track Number %y - Year %g - Genre -track=TRACK Sets the track number to use when tagging files. All files will be tagged with this track number without prompting. TRACK must be an integer between 1 and 99. -upper Convert file names to uppercase characters. -verbose Display more messages than usual. * This option is a toggle. -year=YEAR Sets the year to use when tagging files. All files will be tagged with this year without prompting. And of course the program accepts wildcards for filenames. FILES
*.mp3 All your mp3 files SEE ALSO
lame(1), xmms(1), mpg123(1), mp3blaster(1) BOGUS
If you have questions, comments, or bug reports, please contact cbothamy@free.fr To get the latest version, please visit http://cboth- amy.free.fr/projects/id3ren/ 14 july 2001 ID3REN(1)
All times are GMT -4. The time now is 04:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy