How to bypass error in shell script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to bypass error in shell script?
# 1  
Old 05-08-2007
How to bypass error in shell script?

Hi again,

I have a script that moves files based on filelist:

------------------------------
filelist1=./rated.txt

for file in $(< $filelist1)
do
mv ./$file ./Backup/$file
done
------------------------------

If the file in filelist is not found from the folder the script fails. Is there any way to avoid this? So, just to move those files found and ignore the errors for those not found.

Thanks,
-M-
# 2  
Old 05-08-2007
Code:
filelist1=./rated.txt

for file in $(< $filelist1)
do
    [ -f $file ] && mv ./$file ./Backup/$file
done

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bypass crontab??

Hi there. I've put something in crontab that my raspberry doesn't like, it's trying to draw a window before the graphics are ready after login. Problem being after the error it throws me back to the login, so I can't log in. There is only one user setup on this raspberry so I can't log in... (6 Replies)
Discussion started by: MuntyScrunt
6 Replies

2. HP-UX

Bypass stale PE ?

Hello, I have an ancient HP-UX 11.11 system where I have a logical volume marked stale and I can't get it sync'd. I have tried lvsync and lvreduce/lvextend to no avail. It is just one 4Mb PE on the disk that I can't get current. # lvdisplay -v /dev/vg00/lvol5 | grep stale LV Status ... (17 Replies)
Discussion started by: port43
17 Replies

3. Shell Programming and Scripting

awk Division By Zero Bypass

Hi Friends, I don't understand why "a" is always being printed as zero, when I execute the following command. awk '{if($6||$8||$10||$12==0)a=b=c=d=0;else (a=$5/$6);(b=$7/$8);(c=$9/$10);(d=$11/$12); {print... (6 Replies)
Discussion started by: jacobs.smith
6 Replies

4. Shell Programming and Scripting

Calling shell script within awk script throws error

I am getting the following error while passing parameter to a shell script called within awk script. Any idea what's causing this issue and how to ix it ? Thanks sh: -c: line 0: syntax error near unexpected token `newline' sh: -c: line 0: `./billdatecalc.sh ... (10 Replies)
Discussion started by: Sudhakar333
10 Replies

5. Shell Programming and Scripting

Script to bypass the password field

Hello all Im trying to write a script that can get past the "enter password" field.Coming to the details, Im planning to write a script that can actually check for the validity of certificates in websphere. There is a utility "keytool" that helps provide this information.However if we want to... (4 Replies)
Discussion started by: coolkid
4 Replies

6. 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

7. Cybersecurity

authentication bypass vulnerability

what does it mean? I searched in google but I could not find a clear document that explain to me what does it mean. (1 Reply)
Discussion started by: programAngel
1 Replies

8. Solaris

can't bypass password authentication

I can able to SFTP from my web server unix to apps server unix end. but the other way from APPS server to Web server is still asking me the password. I have done same procedure both side. still i am having same problem. Any one help on this. thanks, regards (3 Replies)
Discussion started by: vijill
3 Replies

9. Shell Programming and Scripting

How to grep sql error in shell script and exit the script?

I need help in the following script. I want to grep the sql errors insert into the error table and exit the shell script if there is any error, otherwise keep running the scripts. Here is my script #!/bin/csh -f source .orapass set user = $USER set pass = $PASS cd /opt/data/scripts echo... (2 Replies)
Discussion started by: allinshell99
2 Replies

10. 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
Login or Register to Ask a Question