What wrong with the variable definition


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting What wrong with the variable definition
# 1  
Old 09-15-2006
What wrong with the variable definition

i am using the below script and trying to move files in that directory in that pattern to archive. But it doesn;t seem to take the metacharacters. Please sugggest.

Code

Quote:
sourcefilepattern=$1_$2_???_$OLD_DT.dat
for file in $sourcefilepattern ; do
mv "$file" $srcarchive
compress $srcarchive/"$file"
Debug output:

Quote:
sourcefilepattern=AUD02_TLG_DLY_???_20060821.dat
+ mv AUD02_TLG_DLY_???_20060821.dat /amdata/srcfiles/Archive
mv: AUD02_TLG_DLY_???_20060821.dat: cannot access: No such file or directory
# 2  
Old 09-15-2006
Are you sure there are any files matching that pattern? If it matches no files at all, it will not expand the pattern.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Variable definition inside mysql query

Hello, I am running ubuntu16.04. By means of @Rudic's help, I have below command. What I need to do is to replace video_id by value of video_id in which WHERE clause is matched: {print "INSERT INTO video_series_files (id, video_id, file_type, protocol, \ url, languages, quality, accessed... (12 Replies)
Discussion started by: baris35
12 Replies

2. UNIX for Dummies Questions & Answers

Environment variable definition

I'm a bit confused about the term ‘environment variables'. Within your shell you can set two types of variables: 1. Shell variable - affecting functionality within your shell 2. User defined variable When using the ‘export' command on a variable you make sure it's being inherited by new sub... (2 Replies)
Discussion started by: niels
2 Replies

3. Shell Programming and Scripting

Storing the value of a single query to a Variable - What am i doing wrong?

I tried the below : #!/bin/ksh testvar=$( sqlplus $user/$pass << EOF set pagesize 0 feedback off verify off heading off echo off; whenever sqlerror exit 1 SELECT 1+1 FROM DUAl; COMMIT; EXIT; EOF) echo "testvar="$testvar The output that I am getting is : > sh example.sh... (3 Replies)
Discussion started by: SriRamKrish
3 Replies

4. UNIX for Advanced & Expert Users

Variable definition

Hi all, I'm bit new to the advanced bash shell scripting. When I'm looking at some of the existing code in my organization, got confused with a few variable definings. For ex: var1={1:-30} var2="abc def ghi" var3={xyz:-$var2} In above, 1st and last lines are confusing me.... (4 Replies)
Discussion started by: raghu.iv85
4 Replies

5. What is on Your Mind?

Definition of Bytes

A byte is the smallest unit of storage which can be accessed in a computer's memory- either in RAM or ROM.It also holds exactly 8 bits.But its old view one byte was sufficient to hold one 8 bit character.Modern days especially on .NET or international versions of Win 32, 16 bits is needed. ... (2 Replies)
Discussion started by: stoudtLion
2 Replies

6. Shell Programming and Scripting

Why result is wrong here ? whether break statement is wrong ?

Hi ! all I am just trying to check range in my datafile pls tell me why its resulting wrong admin@IEEE:~/Desktop$ cat test.txt 0 28.4 5 28.4 10 28.4 15 28.5 20 28.5 25 28.6 30 28.6 35 28.7 40 28.7 45 28.7 50 28.8 55 28.8 60 28.8 65 28.1... (2 Replies)
Discussion started by: Akshay Hegde
2 Replies

7. Shell Programming and Scripting

What's wrong after assign it to a variable ?

root@intel_5500_server:/tmp# ID_GUEST="01:00.0" root@intel_5500_server:/tmp# echo $ID_GUEST|sed 's%:%\\:%g' 01\:00.0 root@intel_5500_server:/tmp# ID_GUEST_P=`echo $ID_GUEST|sed 's%:%\\:%g'` root@intel_5500_server:/tmp# echo $ID_GUEST_P 01:00.0 root@intel_5500_server:/tmp# if I assign... (1 Reply)
Discussion started by: yanglei_fage
1 Replies

8. UNIX for Dummies Questions & Answers

Loop and variable not exactly variable: what's wrong

Hello guys, This truly is a newbie question. I'm trying to make a loop to execute simultaneous commands indefinitely while using variable. Here is how my mess looks like (this is just an example): #!/bin/bash IP=`shuf -n 1 IP.txt` # I figured this would be easier to select random lines... (4 Replies)
Discussion started by: bobylapointe
4 Replies

9. Shell Programming and Scripting

How to define a variable with variable definition is stored in a variable?

Hi all, I have a variable say var1 (output from somewhere, which I can't change)which store something like this: echo $var1 name=fred age=25 address="123 abc" password=pass1234 how can I make the variable $name, $age, $address and $password contain the info? I mean do this in a... (1 Reply)
Discussion started by: freddy1228
1 Replies

10. UNIX for Dummies Questions & Answers

Definition of $-

Could someone please direct me to a link that gives the definitions for each of the letters from the results of the $- environment variable? It would be nice to know what shell options each of the letters represents, but I am specifically looking for the shell option for 'c' (lowercase c). Thank... (12 Replies)
Discussion started by: sszd
12 Replies
Login or Register to Ask a Question