Sponsored Content
Top Forums Shell Programming and Scripting Help using variable in find rule Post 302708887 by skwyer on Tuesday 2nd of October 2012 11:19:41 AM
Old 10-02-2012
Help using variable in find rule

I'm not able to use a variable in my find rule. It's essentially being ignored.

I'm trying to store a list of file types to ignore in a variable.

This is the relevant code.

Code:
#!/bin/ksh

EXCEPTIONS='-not -name "*.xom" -a -not -name "*.sh" -a -not -name "*.pl"'

/usr/local/bin/find path/to/files $EXCEPTIONS > FileList.txt

When I use the contents of the EXCEPTIONS variable directly, the find rule works. However the variable doesn't work at all? Is this even possible?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find and replace the value in a variable

I have a variable whose value is I="user1:x:1100:1200:ID for user1:/home/user1:/bin/ssh-dummy-shell" I want to replace the last part '/bin/ssh-dummy-shell' with '/bin/true' I tried using sed but it garbled sed 's/\/bin\/ssh-dummy-shell/\/bin\/true' $I Thanks for the help (5 Replies)
Discussion started by: aajmani
5 Replies

2. UNIX for Advanced & Expert Users

Find a environment variable Value !

There is shell script which contains some variables . These variables are used , but they have not declared in the script. I think its a environment variable, so I want to know where these variables are set and given values In .profile or .login..or where to c Please give the full path and... (1 Reply)
Discussion started by: tkbharani
1 Replies

3. UNIX for Advanced & Expert Users

Find a environment variable Value !

There is shell script which contains some variables . These variables are used , but they have declared in the script. I think its a environment variable, so I want to know where these variables are set and given values In .profile or .login..or where to c Please give the full path and file... (3 Replies)
Discussion started by: tkbharani
3 Replies

4. Shell Programming and Scripting

Find whether the variable holds value or not

when i run a select query in database, it will return the objid based on the condtion. If there is no objid tht meets the condition, I will not get any value returned and the variable will hold nothing... so now how to chk tht the variable is blank or not. I tried the below piece of code: if ;... (6 Replies)
Discussion started by: harish409
6 Replies

5. Shell Programming and Scripting

How can we use a variable value in find command

Hi All: I want to write a shell script to store OS current date - 1 day value in a variable. Current Date is: 22042010 and new value is 21042010 I have multiple files having date value in name in ddmmyyyy format for multiple day, so I want to find all the files based on the date... (3 Replies)
Discussion started by: lodhi1978
3 Replies

6. Shell Programming and Scripting

how to find the value of a variable in zsh?

I have a zsh script written by someone else, I am trying to modify it to work on slightly different data -problem is I know nothing about shell scripting. I am trying to muddle through this myself since I need to learn but can someone tell me how to debug a script? ie. I want to display the value... (6 Replies)
Discussion started by: cmp260
6 Replies

7. IP Networking

iptables - most easy way to find rule and remove it?

I have situation where I have rules in iptables with comments. Now... I can for example enter rule like "iptables -A FORWARD -s xxx -j ACCEPT" and delete it with "iptables -D FORWARD -s xxx -j ACCEPT".. but if that rule contain some random comment (-m comment) then ... ? I can find with scripting... (2 Replies)
Discussion started by: darkman_hr
2 Replies

8. Solaris

Jumpstart -- Warning: Could not find matching rule in rules.ok

I just setup a new jumpstart server, and I'm having problems with rules.ok errors. I'm coming up blank after many Google searches, forum searches, etc..... This is the error I receive: Skipped interface e1000g1 Attempting to configure interface e1000g0... Configured interface e1000g0... (0 Replies)
Discussion started by: christr
0 Replies

9. Shell Programming and Scripting

Find string in variable

korn shell, testing if a pattern exist in a string, x is constant, y could be none,all or any combination of the elements of x, x="aa bb cc dd ee ff gg hh ii jj kk ll" y="ff kk" for z in `echo ${x}` do if <any pattern in $y matches any pattern in $x> ] then do something fi... (3 Replies)
Discussion started by: squrcles
3 Replies

10. Shell Programming and Scripting

How to find no of underscores in a variable?

Hi i have a variable var=a_b_c i want command to find no. of underscores in a variable Thank you (7 Replies)
Discussion started by: pracheth
7 Replies
All times are GMT -4. The time now is 10:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy