cp -v command usage?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting cp -v command usage?
# 1  
Old 11-22-2011
cp -v command usage?

I am trying to output a log file from cp usage. I think this can be achieved. In my code I have this.

Code:
cp -i -v ~/files/* ~/backups/oldfiles/;; > ~/logs/logfile.log

The error I get is "syntax error near unexpected token '>'

What am I missing?
# 2  
Old 11-22-2011
Hi
check for the double ';' at the end of the second path: probably a typo error?

fra
# 3  
Old 11-22-2011
If I take away the second ; it now gives me

"syntax error near unexpected token ')'

My actual code is,

Code:
s) cp -i -v ~/files/* ~/backups/oldfiles/; > ~/logs/logfile.log

^ It is part of a case statement
# 4  
Old 11-23-2011
Please try:

Code:
s) cp -i -v ~/files/* ~/backups/oldfiles/ > ~/logs/logfile.log ;;

and let us know if you get the desired result (I didn't understand that the instruction was part of a case statement).

fra
# 5  
Old 11-23-2011
Yes, sorry. I worked this out myself but internet was down so could not reply. All working fine now. Smilie

Out of curiosity, is there a quick way of asking the user if they want to overwrite the log file in the script like I do with the -i on cp?
# 6  
Old 11-24-2011
I don't think there is a faster way; perhaps somebody else can suggest such a way.
Anyway, 'cat' already offers the '-i' switch... so, who cares? =)

Have a nice day
fra
# 7  
Old 11-24-2011
Sorry, I do not understand how I would implement cp and cat in the one line? I tried

Code:
s) cp -iv ~/files/* ~/backups/oldfiles/ > cat -i ~/logs/logfile.log;;

It gives me a not a directory message for the logs area. Not sure what to do.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Usage of '.' in MV command

Hi, Could you please let me know, why we should not use '.' in move command, if we use it, is it something wrong.. Please share the details on it. /home/rahualux/emp.csv /home/rahualux/details/employee_files/. Or other example for mutlipile files /home/rahualux/*.csv... (3 Replies)
Discussion started by: rahualux
3 Replies

2. UNIX for Dummies Questions & Answers

Sort command usage

I have one file like this: NEW /ifs/SQL_Backups3/SQL_SharePoint1 NEW /ifs/SQL_Backups/SQL_SharePointThis can be easily sorted by the following command: cat file| sort -k3,3nBut I have another file like this: /Pool0/local/Benchmark /Pool0/local/CRAD /Pool0/local/crdhw/espresso_scratch1... (5 Replies)
Discussion started by: newbie2010
5 Replies

3. UNIX for Dummies Questions & Answers

sudo - command usage

Hi, I have few doubts regarding "sudo" command. It acutally allows access to other commands as a different user. It stands for "superuser do". Now, we execute a command as sudo su - oracle Can you please tell me what does it do actually, thank you. (6 Replies)
Discussion started by: Dev_Dev
6 Replies

4. Shell Programming and Scripting

Usage of prealloc command

hi please tell me the usage of prealloc command. (1 Reply)
Discussion started by: 2002anand
1 Replies

5. UNIX for Dummies Questions & Answers

Command to display the space usage (memory usage) of a specific directory.

Hi all, Can you please tell me the command, with which one can know the amount of space a specific directory has used. df -k . ---> Displays, the amount of space allocated, and used for a directory. du -k <dir name> - gives me the memory used of all the files inside <dir> But i... (2 Replies)
Discussion started by: abhisheksunkari
2 Replies

6. HP-UX

Glance command Usage

Hello We have used Glance command to check Cpu Uage , bit new to Glance command , HP-UXdev # glance B3692A GlancePlus C.03.71.00 18:21:16 nedunix2 9000/800 Current Avg High -------------------------------------------------------------------------------- CPU Util S SN NU | 43% 59%... (1 Reply)
Discussion started by: lukas_pise
1 Replies

7. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

8. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

9. UNIX for Dummies Questions & Answers

cksum command usage

Hi All, I am using cksum command in s script to check integrity of set of files transffred across the network. What are the advantages and disadvantages/limitations of this command? Is the byte count return reliable? What are the other alternatives I could use for this purpose? ... (2 Replies)
Discussion started by: Axis99
2 Replies

10. UNIX for Dummies Questions & Answers

file command usage

Hi, i would like to determine how many shell scripts are in a directory. Someone recommended me the file command, but i don't know how to use it in that way. anybody??? Thanks!!! (8 Replies)
Discussion started by: kfad
8 Replies
Login or Register to Ask a Question