Sponsored Content
Full Discussion: Copy command does not work
Top Forums Shell Programming and Scripting Copy command does not work Post 302935811 by smurphy_it on Thursday 19th of February 2015 09:16:49 AM
Old 02-19-2015
steps you provided aren't quite matching up

Good day. You originally posted:
Code:
1. Generate Term file
2. Remove previous term and rpt files from utility directory.
3. copy term file to utility directory
4. call sql to generate rpt file using term file as input
5. copy the generated rpt file from run directory to utility directory.

However, you commands contradict your steps. For example, step #5 says to copy the generated SQL file from run directory to the utility directory. Yet, the copy command [CODE][cp utl/nj.RPT RUN_DIR/CODE] is contradicting that.

Additionally, you are dealing with relative paths instead of absolute paths (as previously point ed out) and there doesn't seem to be any error checking in case one of your steps fail (such as a rm or cp command).

You are also using references to /util in some lines and util/ in others... one being an absolute path, whilst the other is a relative path. Not to mention, are there two seperate files nj.rpt and nj.RPT ?

I would suggest you use absolute paths for starters. Additionally, the ; may be required after the ]] in your if then statement. Additionally, the RUN_DIR... is this a directory, or supposed to be a variable ?

If you fix up your variables and use absolute paths, that should rememdy your situation.

Last edited by Scrutinizer; 02-19-2015 at 11:56 AM.. Reason: Changed code tags to code tags
 

10 More Discussions You Might Find Interesting

1. HP-UX

ls command doesnt work

Good Day I mistakely renamed the dld.sl file in the /usr/lib directory. When i try to ls/ftp into the box i get this error :eek: crt0: ERROR couldn't open /usr/lib/dld.sl errno:000000002 I have tried to rename it back from the renamed file to the original file name, but it gives me the... (2 Replies)
Discussion started by: shawnbishop
2 Replies

2. UNIX for Dummies Questions & Answers

Command work but not in SH script

Command works but not in SH At terminal if i type: scp test.tar.gz user1@server2:/home/user Everything run smoothly (keyed, no password need) At script , test.sh #!/bin/sh scp test.tar.gz user1@server2:/home/user Nothing happen and clue ? ? ? ? ? (3 Replies)
Discussion started by: cititester
3 Replies

3. UNIX for Dummies Questions & Answers

at command does not work

at command does not work with graphic programs like firefox, evolution, etc It works with other commands for example: at now shutdown -h now OK but at now firefox does not work Anyone knows if its possible to open a firefox window at a scheduled time? Thanks Jose (0 Replies)
Discussion started by: otilesoj
0 Replies

4. Shell Programming and Scripting

How to make copy work faster

I am trying to copy a folder which contains a list of C executables. It takes 2 mins for completion,where as the entire script takes only 3 more minutes for other process. Is there a way to copy the folder faster so that the performance of the script will improve? (2 Replies)
Discussion started by: prasperl
2 Replies

5. UNIX for Dummies Questions & Answers

Copy a command string from the command line

How can we copy a command string from a previous command line and paste it into the cursor position on the current command line? I know that ^c will not work as the shell will interpret as an interrupt signal. Thanks, (1 Reply)
Discussion started by: Pouchie1
1 Replies

6. Shell Programming and Scripting

scp : recursive copy doesn't work

Hi I have a problem with scp command : I try to copy a list of files from source to destination, it works fine but if there is a directory not existing on destination, it doesn't automatic create. Syntax : scp -rp /<PATH>/<NEW_DIR>/<FILE> <USER_DEST>@<HOST_DEST>:<PATH>/<NEW_DIR>/<FILE>... (5 Replies)
Discussion started by: madmat
5 Replies

7. Shell Programming and Scripting

command does not work

need help, trying make a command where the user presses any keys and it will go to the home page, however it doesnt work, why ? echo -p "press any key to return to main menu" menu if ]; then echo -p "\n" home fi (5 Replies)
Discussion started by: bassmasta1
5 Replies

8. UNIX for Dummies Questions & Answers

copy *. does not work in function

Hi, I want to copy a file/directory ( recursively , if needed) and if destination directory does not exist create it ( with parent directory, if needed). funcopy () { if ; then echo "$2 exists , copying files" cp -r "$1" "$2" else echo "Directory does not exist;Create directory" mkdir... (1 Reply)
Discussion started by: greet_sed
1 Replies

9. UNIX for Dummies Questions & Answers

grep command does not work

Hello. I have a question as to why my grep command does not seem to be working. grep -c '^?*' ~ grep -c '^.*' ~ I wanted to count the number of files starting with the letter K and have some letters after that. I have such files in my home directory. However, the output is 0. So, I have no... (2 Replies)
Discussion started by: FUTURE_EINSTEIN
2 Replies

10. Programming

Shell copy command don't work

I want copy Files: But cp don't work: shell_exec("cp ".$pfad." ".$genzone); shell_exec("cp ../Chrysanthemum.jpg ../test"); Whats wrong? (3 Replies)
Discussion started by: Linuxmann
3 Replies
script(1)							   User Commands							 script(1)

NAME
script - make record of a terminal session SYNOPSIS
script [-a] [filename] DESCRIPTION
The script utility makes a record of everything printed on your screen. The record is written to filename. If no file name is given, the record is saved in the file typescript. See WARNINGS. The script command forks and creates a sub-shell, according to the value of $SHELL, and records the text from this session. The script ends when the forked shell exits or when Control-d is typed. OPTIONS
The following option is supported: -a Appends the session record to filename, rather than overwriting it. NOTES
script places everything that appears on the screen in filename, including prompts. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) WARNINGS
script can pose a security risk when used in directories that are writable by other users (for example, /tmp), especially when run by a privileged user, that is, root. Be sure that typescript is not a link before running script. SunOS 5.10 30 Jan 2004 script(1)
All times are GMT -4. The time now is 04:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy