|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi Please review this script and let me know what i need to do. This is my script Code:
#!/bin/bash #SCRIPT: forms.sh #PURPOSE: Process a file line by line with redirected while-read loop. #PURPOSE: and copy the forms to the follder foldername=sample_dir mkdir -p $foldername while read file; do FILENAME=$(basename $file) LINE=$FILENAME count=0 cp $LINE $foldername/ done < forms.txt i have a file called forms.txt which contains unix directory path. i want to extract the filename alone from the unix directory path. now i am having copy issue with this script. This is the error, i am getting Code:
cp: cannot stat `AKDAPREG.fmb': No such file or directory cp: cannot stat `AKDATTRS.fmb': No such file or directory cp: cannot stat `AKDFLOWB.fmb': No such file or directory cp: cannot stat `AKDFLOWS.fmb': No such file or directory cp: cannot stat `AKDOBFKS.fmb': No such file or directory cp: cannot stat `AKDOBJWB.fmb': No such file or directory cp: cannot stat `AKDOBPKS.fmb': No such file or directory cp: cannot stat `AKDPICKF.fmb': No such file or directory cp: cannot stat `AKDQUERY.fmb': No such file or directory Please let me know your suggestions. Thanks, Rami Reddy. |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Please check your file is present or not in current location where script is running.
Or better way use full path of a file to copy it ![]() |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Try to run the script in debug mode and let us know the result which you are getting. Code:
#!/bin/bash set -x |
|
#4
|
|||
|
|||
|
Hi vikram,
even though i tried in debug mode, i am not getting the copy to destination folder |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Could you please post the line by line execution which took place after running your script in debug mode.
|
| Sponsored Links | |
|
|
#6
|
||||
|
||||
|
Are you sure those
.fmb files are present in the same directory your script is running? Also if you have correct absolute path of these files in form.txt , I suggest you to remove below line: Code:
FILENAME=$(basename $file) and perform copy: Code:
cp "$file" "${foldername}/" |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Cp: cannot stat...: no such file or directory | lutus | UNIX for Dummies Questions & Answers | 2 | 02-02-2013 05:17 PM |
| Mv : cannot stat :no such file or directory | Froob | Shell Programming and Scripting | 1 | 12-20-2012 08:31 PM |
| cp: cannot stat no such file or directory | s_linux | SuSE | 1 | 06-10-2009 11:48 AM |
| cp: cannot stat: No such file or directory | Krush187 | Shell Programming and Scripting | 4 | 04-08-2009 09:20 AM |
| cp: cannot stat `/opt/IBM/cofig.sh': No such file or directory | chanti | Shell Programming and Scripting | 3 | 08-21-2008 03:13 PM |
|
|