make use of the name of files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting make use of the name of files
# 8  
Old 12-13-2006
tried running this one as bash?
# 9  
Old 12-13-2006
Quote:
Originally Posted by vgersh99
tried running this one as bash?
yes, got following errors:

line 5: syntax error in conditional expression: unexpected token `('
line 5: syntax error near `@(S'
line 5: ` if [[ "${file}" == @(S*) ]]; then'
# 10  
Old 12-13-2006
Code:
#!/bin/bash
shopt -s extglob

find . -type f | while read path
do

   file=$(basename "${path}")
   if [[ "${file}" == @(a*) ]]; then
      echo "[$path] run ./a script ?"
   elif [[ "${file}" == @([0-9]*) ]]; then
      echo "[$path] run ./b script ?"
   fi
done

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Make /dev/null all the files

How can I make /dev/null all the 8640 files that I am getting from this command. find . \( ! -name . -prune \) -type f -name "EXPORT_v1x0*" | awk -F'_' '$6<20120812' And then delete everything. If I am using this command to delete it, I am getting Disk Quota Exceeded Exception. find .... (4 Replies)
Discussion started by: raihan26
4 Replies

2. Shell Programming and Scripting

Make 48 disks(files) on solaris 10

Hello, to simulate an environment with 48 disks using Solaris 10 x86, i try toMake 48 disks (files) with MKFILE : #for i in c{0,1,2,3,4,5}t{0,1,2,3,4,5,6,7}d0 >do > mkfile 100m $i >done But i received like result : #ls /test_zfs c{0,1,2,3,4,5}t{0,1,2,3,4,5,6,7}d0 Any help... (2 Replies)
Discussion started by: herbich1985
2 Replies

3. Shell Programming and Scripting

Why are my text files sometimes empty when I make a read to them?

My implementation: I have a script Caller.sh that runs in the background that continuously calls the following scripts: createtext.sh createtext2.sh createtext3.sh Each of these scripts does the following (but with different text file names): #! /bin/bash ... (1 Reply)
Discussion started by: etranman1
1 Replies

4. Homework & Coursework Questions

Find the files and make them comma separated files

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Hi All, I am new to unix, my requirement is like need to find the files like DATA_FUNCTION* and put those... (1 Reply)
Discussion started by: madsongtel
1 Replies

5. Programming

Best practice for make files?

I currently have two projects, one being a shared library and the other an application The problem I am facing is that I need to compile and install the library then run an ldconfig before attempting to compile the application(dependency) What would be the best practice for a one time... (0 Replies)
Discussion started by: james2432
0 Replies

6. Shell Programming and Scripting

Using Make to batch process files

Hello all, I have a make question, and I was hoping somebody here might be able to point me in the right direction. Here is my issue; I have a command-line tool that I use to run a conversion on an input XML file that results in an output binary file. However, this particular tool needs to... (1 Reply)
Discussion started by: jujumbura
1 Replies

7. Shell Programming and Scripting

Make script delete certain files

Hi, In a directory, say ~/dir is a lot of files and subdirectories. Some of the files are named res1.om res2.om ... res65.om The amount of files varies. I need a .csh script that deletes all res*.om files except the one with the highest number. Any suggestions? Thanks in... (6 Replies)
Discussion started by: pederlol
6 Replies

8. Solaris

message in make files

dear all i have sources contains make file and it okay but suddenly when user make any file it gives the message below make: Entering directory `/devapp/jordev/batch/source' i know it just echo and not error or warning but i want to remove this from make file and there is no message is... (3 Replies)
Discussion started by: murad.jaber
3 Replies

9. UNIX for Dummies Questions & Answers

How can I make dos2unix in hp without renaming files?

Hello all It seams that in HPUX when Im using dos2unix program I need to rename the file to new file and then back if I like to Format the file. Is there shorter way to do this? Thanks (2 Replies)
Discussion started by: umen
2 Replies

10. Shell Programming and Scripting

Make files

I am having problems with running a make file from a different directory. Is there a way of doing this? (2 Replies)
Discussion started by: Dan Rooney
2 Replies
Login or Register to Ask a Question