Visit Our UNIX and Linux User Community

Error while renaming file

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Error while renaming file
# 1  
Old 10-27-2009
Error while renaming file

After running he following command to rename a file:
[root@wiki ~]# mv 'Linux CPU (EDF).sh' LinuxCpu(EDF).sh

I am getting the following error:
-bash: syntax error near unexpected token `('

Why is this happening?
# 2  
Old 10-27-2009
Brackets are symbols that the shell wants to interpret. Enclose the new filename in single quotation marks too.
# 3  
Old 10-27-2009
Is it because i didn't escape the brackets in the new name?

---------- Post updated at 07:26 AM ---------- Previous update was at 07:25 AM ----------

Thanks, got it

Previous Thread | Next Thread
Test Your Knowledge in Computers #594
Difficulty: Easy
In the C programming language, variables are scoped to the code block in which they are declared and are only valid within that code block.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Renaming files - error

set -vx for i in ~/Shell_Practice/rename/*.txt do t=`(echo $i | awk gsub("file","newfile"))` mv $i $t done while running the above code getting below error.Please help. atomic@atomic-VirtualBox:~/Shell_Practice/rename$ ./ for i in ~/Shell_Practice/rename/*.txt ... (8 Replies)
Discussion started by: nag_sathi
8 Replies

2. UNIX for Advanced & Expert Users

Error while renaming the file in SFTP Session

Hi All Below is the script I am trying to execute to rename a file in an SFTP session. It is in GNU/Linux. This script is for generic use and so I am passing arguments. Everything in the script works fine except "reading the filename in SFTP session" In the below script the... (2 Replies)
Discussion started by: sparks
2 Replies

3. Shell Programming and Scripting

Renaming the file

Hi guys, I have written a code to move my file from one directory to another directory, the file is in .csv format and i need to append a current date to the file. the prolem is date is getting appended after the file extension.. here is my code : cd /data/home/abc/xyz now=$(date... (7 Replies)
Discussion started by: azherkn3
7 Replies

4. Shell Programming and Scripting

Renaming file and check for the renamed file existence

Hi Am trying to move a file from one name to another When I do "ls" to check for the moved filename I can see the file but when I try the same with a script am unable.. I think am doing some pretty silly error.. please help.. toMove=`ls | grep -E "partition.+"` mv $toMove partition._org... (7 Replies)
Discussion started by: Priya Amaresh
7 Replies

5. Shell Programming and Scripting

Renaming file

Hello, I have an outstanding issue..Iam on linux and using a putty to connect to my server and then fire our unix shell script. At location /usr/sam a file called "er 1 32.txt" out boss transfer via application. From my end on terminal when i want to transfer this file to some other location... (2 Replies)
Discussion started by: j_panky
2 Replies

6. Shell Programming and Scripting

File renaming from list of names contained in another file

I have to rename a large number of files so that the name of each file corresponds to a code number that is given side by side in a list (textfile). The list contains in column A the filename of the actual files to be renamed and in column B the name (a client code, 9 digits) that has to be... (7 Replies)
Discussion started by: netfreighter
7 Replies

7. Shell Programming and Scripting

bad substitution Error while renaming Extension

Hi All, We are in the process of Migrating from AIX 4 to Solaris 10 and getting a Few Errors. I have been programming in shell but could never establish muself as an expert, hence please need you help. I am Getting Bad Substitution error in my script, I have isolated the issue and its... (6 Replies)
Discussion started by: paragkhanore
6 Replies

8. Shell Programming and Scripting

Renaming a file use another file as a sequence calling a shl

have this shl that will FTP a file from the a directory in windows to UNIX, It get the name of the file stored in this variable $UpLoadFileName then put in the local directory LocalDir="${MPATH}/xxxxx/dat_files" that part seems to be working, but then I need to take that file and rename, I am using... (3 Replies)
Discussion started by: rechever
3 Replies

9. Shell Programming and Scripting

Getting error by renaming all the files in a folder

Hi All, I have a folder name as postscript folder and it contains the following postscript files. when i am renaming all the ps files to xps files by using the following command mv /postscript/*.ps /postscript/*.xps Then i am getting the... (4 Replies)
Discussion started by: sunitachoudhury
4 Replies

10. Shell Programming and Scripting

Renaming a file name

I have an audit log that is produced each day from a production printer. It names the file using todays date, but it removes the leading zero's. For example: todays date 060104 names the file 6104.txt. I ftp this file onto a Sun box and pull stats off of it. To keep some consistency to what I am... (2 Replies)
Discussion started by: dbrundrett
2 Replies

Featured Tech Videos