The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Sorting Directory Listing Sepia UNIX for Dummies Questions & Answers 1 07-11-2007 08:44 AM
How can i get directory listing? haisubbu UNIX for Dummies Questions & Answers 2 08-25-2006 10:03 AM
Full Directory Listing... B14speedfreak UNIX for Dummies Questions & Answers 5 05-11-2006 09:06 AM
Timestamp in directory listing vijashok UNIX for Dummies Questions & Answers 2 10-06-2005 11:03 AM
Recursive directory listing without listing files psingh UNIX for Dummies Questions & Answers 4 05-10-2002 11:52 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 10-10-2008
gugs gugs is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 44
Listing a directory via a script using variables

In my script I need to list the directory, where the generic name of the files will change, in my test case its set to TEST_*.mqsc. I wrote a small test script as below, but it just does not pip the listing to a file.
Any idea why?

dir='C:/cygwin/var/log/img/aut/'
file=TEST01_*.mqsc
ls $dir | grep "$file" > test.txt


When I run it in debug I get the following:

$ bash -x test.sh
+ dir=C:/cygwin/var/log/img/aut/
+ file='TEST01_*.mqsc'
+ ls C:/cygwin/var/log/img/aut/
+ grep TEST01_080924.mqsc TEST01_080925.mqsc TEST01_080926.mqsc TEST01_080927.mq
sc TEST01_080928.mqsc TEST01_080929.mqsc TEST01_080930.mqsc TEST01_081001.mqsc T
EST01_081002.mqsc TEST01_081003.mqsc TEST01_081004.mqsc TEST01_081005.mqsc TEST0
1_081006.mqsc TEST01_081007.mqsc TEST01_081008.mqsc TEST01_081009.mqsc TEST01_08
1010.mqsc
+ rc=1
+ echo 'Return Code is: 1'
Return Code is: 1
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:43 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0