Simple question abt Copy command.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Simple question abt Copy command.
# 1  
Old 09-08-2008
Simple question abt Copy command.

Hi ! All

This is very simple question....

How to write a 'cp' command interative.

Example :

cp /wlsuite/om/cm/Tools/deploy_scripts/*.xml ${INF_ROOT}/tmp | echo "[DONE]" || echo "[ERROR] Pls investigate ..."

My intent was
> to copy the files.
> CP fails... then let know the user.

pls help...
# 2  
Old 09-08-2008
Don't pipe to echo "[DONE]", it doesn't do what you want and masks out the return code from cp

Perhaps you meant

Code:
cp stuff && echo done || echo error

The cp command will display an error message by itself if copying fails, so perhaps what you are doing is superfluous.
# 3  
Old 09-08-2008
Quote:
cp stuff && echo done || echo error
Am adding small correction to that

Code:
cp stuff stuff_copied && echo done || echo error

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

A simple question about mail command

Simple question: i read mail n°4,how to return to list of messages? (2 Replies)
Discussion started by: Linusolaradm1
2 Replies

2. Red Hat

Syslog.conf: looking for a simple answer on a simple question

Cheers! In /etc/syslog.conf, if an error type is not specified, is it logged anywhere (most preferable is it logged to /var/log/messages) or not? To be more precise I am interested in error and critical level messages. At default these errors are not specified in syslog.conf, and I need to... (6 Replies)
Discussion started by: dr1zzt3r
6 Replies

3. UNIX for Dummies Questions & Answers

Help me with this simple file copy from Unix

Hello, Imagine I am on a Unix system, connected to server via telnet. I do 'ls' and I see the file listed - OK. Filename=ems.log. Then I need to copy such file from this server to my Windows network share \\windowsserver\myshare\smith. How can I do that? (2 Replies)
Discussion started by: marlon2010
2 Replies

4. UNIX for Dummies Questions & Answers

help abt cut command

Hi friends, I have a small doubt about cut command. cut -f2 -d_ Can anybody tel me what does the underscore after 'd' stand for? Is it some kind of comment, coz I am not able to make out any difference when I executed the below command... head -10 file.txt|cut -f2 -d_ It was... (3 Replies)
Discussion started by: divzz
3 Replies

5. Shell Programming and Scripting

The cut command. Really simple question!

hi, sorry for asking what I am sure is a really easy question, I am wanting to cut the users real name from the output of 'finger'. $ cut -f2-3 filename is in my script but it only seems to cut the first line. I need to cut the 2nd and 3rd word from each line and store them in variables... (1 Reply)
Discussion started by: rorey_breaker
1 Replies

6. UNIX for Dummies Questions & Answers

Some simple question abt Unix kernel

Dear all, I got some questions abt how does the Unix kernel work with the work with the other components. (step by step) Can any body tell me some info abt that? if can provide a example for each question that gonna be perfect! Thank you!!! 1. How file management system work together... (2 Replies)
Discussion started by: melbdavid
2 Replies

7. UNIX for Dummies Questions & Answers

Simple Command (head) Question

Okay, this probably sounds dumb for anyone who knows the answer, but I'm completely lost. I have to use the head command to search a directory AND all of its subdirectories to display the first line of all .txt files. I know how to do this: head -1 ~/UnixCourse/*.txt, but that does not search the... (4 Replies)
Discussion started by: jbud
4 Replies

8. UNIX for Dummies Questions & Answers

Simple Copy?

I need to copy a file from one directory into another - but it has to be the 'most recent' directory - a new diretory gets created each week. Copy a file from one directory into another is easy enough - how do I find/specify the most recent directory? (4 Replies)
Discussion started by: twomdsi
4 Replies

9. UNIX for Dummies Questions & Answers

Ok simple question for simple knowledge...

Ok what is BSD exactly? I know its a type of open source but what is it exactly? (1 Reply)
Discussion started by: Corrail
1 Replies

10. UNIX for Dummies Questions & Answers

SImple command question

Does anyone know the command to get the date CREATED for a file? This is driving me berserk. Windows has it. But I cannnnnnot remeber what it is in UNIX! Thanks! (4 Replies)
Discussion started by: Diabeticus
4 Replies
Login or Register to Ask a Question