'*' not working in shellscript


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting '*' not working in shellscript
# 1  
Old 01-03-2013
Display '*' not working in shellscript

Hi,

To Archive files, I try to move files from one directory to another directory . So i used the below logic,

Code:
#!/bin/ksh

 
****Archive*****

mv ${DATA_DIR}/ABC_.dat ${ARCHIVE}

So if i give the complete file name its working fine. But if i use '*', im getting the below error,

mv: cannot stat `PATH`: : No such file or directory

Please help me in this.
Thanks,
Bopty SmilieSmilie

Last edited by Scrutinizer; 01-03-2013 at 03:16 AM.. Reason: code tags
# 2  
Old 01-03-2013
Please use CODE tags!

What does the command ****Archive***** do?

How was DATA_DIR set?

How was ARCHIVE set?

Is ABC_.dat a directory in "$DATA_DIR"? By convention, a filename ending in .dat is usually a regular file containing data; not a directory.
# 3  
Old 01-03-2013
Can you post the complete script here?
# 4  
Old 01-03-2013
Hi Don,

Thanks for your Reply.

Instead of # i used * (i.e:###Archive###) here but not in the script.

$DATA_DIR is set to data file path and $ARCHIVE is set to Archive file path. I do echo for the same, its showing the correct path. But the thing is '*'. If i use '*' for data file its throwing the error.

PFB the script,

Code:
#!/bin/ksh
 
export PROGRAM_NAME=`basename $0 .ksh`
 
. ${RMS_RPAS_HOME}/rfx/etc/rmse_rpas_config.env
. ${LIB_DIR}/rmse_rpas_lib.ksh
 
#######
#Archiving
#######
 
mv ${DATA_DIR}/ABC_*.dat ${ARCHIVE}


Last edited by Scrutinizer; 01-03-2013 at 03:18 AM.. Reason: code tags
# 5  
Old 01-03-2013
why cant u use

Code:
cd ${DATA_DIR}
mv ABC_*.dat ${ARCHIVE}
cd -

# 6  
Old 01-03-2013
Tried the same, but still it throwing the error Smilie
Code:
mv: cannot stat `ABC_*': No such file or directory


Last edited by Franklin52; 01-03-2013 at 03:34 AM.. Reason: Code tags
# 7  
Old 01-03-2013
is there such a file named ABC_*?? Smilie Just wanted to make sure!!
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Telnet shellscript

cat << EOF | telnet alt1.aspmx.l.google.com 25 HELO verify-email.org MAIL FROM: <check@verify-email.org> RCPT TO: <test@gmail.com> quit EOF Hello, I'm trying to get the result of that execution, and can not see the result or bring it to a txt ... the direct command in ssh running the result... (5 Replies)
Discussion started by: c0i0t3
5 Replies

2. Shell Programming and Scripting

Help with shellscript

I am new in shell script i want to convert .txt file in the format axsjdijdjjdk to a x s j d i j d j j d k (5 Replies)
Discussion started by: sreejithalokkan
5 Replies

3. Shell Programming and Scripting

Needed shellscript for the following

hi all, i need the shell script for he below requirement i had the input file as a_20121217_035120( frmat is a_date_hhmmss) a_20121217_035128 a_20121217_035456 a_20121217_035767 a_20121217_035178 a_20121217_035189 a_20121217_035220 my output should be a_20121217_035456... (0 Replies)
Discussion started by: hemanthsaikumar
0 Replies

4. UNIX for Dummies Questions & Answers

How can I do aliasing in shellscript?

#Example.sh alias rmv 'sh Example2.sh' when i execute exapme.sh alias name not working. how i solve this problem?? (9 Replies)
Discussion started by: arun508.gatike
9 Replies

5. Shell Programming and Scripting

Need help with shellscript

Hello. I am a novince at writing shell scripts but here is the question. I have to write a shell script that does the following: Once executed via crontab, the script should do the following: a. get date/time stamp in for format 10-MAR-05 and b. execute shell script my_script.sh (which... (2 Replies)
Discussion started by: jigarlakhani
2 Replies

6. UNIX for Advanced & Expert Users

shellscript problem

hI, Pls consider the following shell script #!/bin/csh -f sqlplus tkyte/tkyte <<"EOF" > tmp.csh set serveroutput on declare a number:=5; begin dbms_output.put_line( 'a:='||a ); end; / spool off "EOF" The above script does the followin 1)it connects... (1 Reply)
Discussion started by: ravi raj kumar
1 Replies

7. Programming

Shellscript for MQSeries

Iam new to shellscript. 1)How to strart QUERYMANAGER using shellscript. 2)How to put and get messages in MQSeries using shellscripts. 3)iam using local queues . Thanks lot. (0 Replies)
Discussion started by: ram2s2001
0 Replies

8. Shell Programming and Scripting

Another shellscript question

Folks; on a unix server I have a mapping file which holds a list mountpoints of all databases and their mountpoints. tab delimited or colon deliminted..I needed to copy the datafiles from the pristine mountpoints to test's mountpoints in this case. I needed to do this by passing sid name using... (18 Replies)
Discussion started by: jigarlakhani
18 Replies

9. UNIX for Advanced & Expert Users

ftp in Shellscript

Can I do something like this from a shellscript ?: ftp 12.34.56.78 <<! username password put a.c bye ! It does not go through as the login fails. Is there any alternative to do the above requirement? Thanks in advance. Gowrish (3 Replies)
Discussion started by: ggowrish
3 Replies
Login or Register to Ask a Question