Move command in the shell isnt executing...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Move command in the shell isnt executing...
# 1  
Old 02-01-2005
Move command in the shell isnt executing...

-----------------------------------------------------------------------------Pls find my Q in the bottom---------------------------------------------
#!/bin/ksh
#+----------------------------------------------
#|
#| Usage: . scripts/run_all.ksh < scripts/run_all.txt
#|
#| This script executes sql loader for all
#| flat file input to staging tables, then
#| extracts successful and discarded record
#| counts, and finally zips the data and moves
#| it into a backup directory with the date
#| in the filename.
#|
#| --thw 1/12/05
#|
#+----------------------------------------------
. .profile
export ORACLE_SID=AHP2DD
while read filename;do
sqlldr parfile=$filename.par
grep -E -i "records read|successfully|skipped|rejected|discarded" log/$filename.log >> log/run_all.log
echo "STATISTICS FOR INPUT FILE $filename" >> log/statistics.log
grep -E -i "records read|successfully|skipped|rejected|discarded" log/$filename.log >> log/statistics.log
echo "END" >> log/statistics.log
#
# build the backup file name
#
j1=`date | cut -c 5-7,9-10,12-13,15-16`
#
# zip and move the data
gzip data/$filename.TXT
mv data/$filename.TXT.gz backup/$filename$j1.TXT.gz
done
--------------------------------------------------------------------------

The script is working till gzip but the 'mv' is not getting executed and throws the Error:

Usage: mv [-i | -f] [--] src target
or: mv [-i | -f] [--] src1 ... srcN directory.

help needed,

Thanks,
Thumsup
# 2  
Old 02-01-2005
Quote:
mv data/$filename.TXT.gz backup/$filename$j1.TXT.gz
try enclose "


Code:
   mv "data/$filename.TXT.gz" "backup/$filename$j1.TXT.gz"


as output of `date | cut -c 5-7,9-10,12-13,15-16`
is resulting spaces in between ....
# 3  
Old 02-01-2005
Thanks alot Bhargav!!!

That Worked.U right,I missed the double quotes.


Thumsup
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Executing 'exit' command from shell script

Hi, I am writing shell script to automate few use cases for CLI interface. We have CLI interface which has bunch of commands. I am trying to execute one of the commands 'exit' as part of automation to exit from CLI object (not from shell script) in my shell script. My intension is to execute... (4 Replies)
Discussion started by: Mahesh Desai
4 Replies

2. UNIX for Dummies Questions & Answers

Cron shell script not executing diskutil command

I'm trying to learn how to use cron for repetative tasks. I have an external disk that needs to be unmounted and remounted every hour due to some problems that a backup utility (specifically, TimeMachine) is having repeatedly accessing the device. I've created a shell script that will find the... (3 Replies)
Discussion started by: illuminate
3 Replies

3. UNIX for Dummies Questions & Answers

Executing a tar command with the --exclude option in a Debian shell script.

Hi All, I am trying to execute the following tar command with two --exclude options to suppress extract of the two directories specified. Do I need to single quote the directory paths ?? Many thanks for your help. The relevant code excerpt from the script is: cd /var/www/${SITE} ... (7 Replies)
Discussion started by: daveu7
7 Replies

4. Shell Programming and Scripting

executing command in a remote machine through ssh - shell script

Hi All, i have two machines like x and y . my requirement is i should connect to machine Y from x through ssh connection . and do some operation such as copy and move and delete files in Y machine . i tried with this code but it is doing in machine x only . and i need to exit from Y when... (1 Reply)
Discussion started by: rateeshkumar
1 Replies

5. Shell Programming and Scripting

Problem Executing Firmware Command using Shell Script

Guys, I have a script that should change one of the configuration Parameter in a http accelerator, this config change which will halt http traffic into device. So I have designed a script which should do these changes. But after executing this script, found that one of the input variable is not... (8 Replies)
Discussion started by: raghunsi
8 Replies

6. UNIX for Advanced & Expert Users

executing a command on parent shell

Hi, I am logging in from my PC terminal to a linux host using ssh. Is it possible to execute a command on the parent PC terminal from the linux host during login. NOte that the parent PC does not have sshd running. Sam (1 Reply)
Discussion started by: sardare
1 Replies

7. Shell Programming and Scripting

Error executing shell command from a perl script

Hi Gurus, I've a find command that gets the list of files from a source directory where the extension is not html, xml, jsp, shtml or htaccess. The below find command runs fine from the command prompt or in a shell script. I need to eventually run it in a PERL script and am getting the... (5 Replies)
Discussion started by: voorkey
5 Replies

8. UNIX for Dummies Questions & Answers

SED command is not executing within the shell

Hallo everybody I am having a shell script called auto_run.sh in that only the first line works. the second line which has sed command is working only at the # prompt. not within the shell script. Your help is highly appreciated.Thank you in advance. exec auto_inv.4ge >KTI sed 's/ //g'... (1 Reply)
Discussion started by: naushad
1 Replies

9. Programming

Not able to see the inputted command on the shell prompt..but its executing the comnd

Hi , I m writing a program which involves piping(pipes). In my program, once i execute the child process (dealing with pipe),I m not able to see any inputted command on the screen....but the entered command is getting executed... Actaully inorder to implement piping i hav closed STDIN and... (3 Replies)
Discussion started by: Crab
3 Replies

10. Shell Programming and Scripting

Why passwd isnt working in shell scripts?

I had to write a script to change my login password, and the script wasnt working fine. When I searched through the previous postings in this forum, I got the solution (using 'expect' tool). But I would like to know why passwd command isnt working in scripts? (1 Reply)
Discussion started by: Deepa
1 Replies
Login or Register to Ask a Question