06-10-2004
How can I put wildcards in an if statement that uses variables?
With the if statement:
if [ -f /098/access.${CURR_DAY_DAY}${CURR_DAY_MONTH}-12AM.gz \
-a -f /789/access.${CURR_DAY_DAY}${CURR_DAY_MONTH}-12AM.gz \
-a -f /456/access.${PREV_DAY_DAY}${PREV_DAY_MONTH}-11PM.gz \
-a -f /123/access.${CURR_DAY_DAY}${CURR_DAY_MONTH}-12AM.gz ]
How can I make it so it accepts a wildcard after the ${CURR_DAY_MONTH} variable?
Putting
a -f /webtrends/SUN/mrw2/access.${CURR_DAY_DAY}${CURR_DAY_MONTH}*
won't work, right? I think I need some kind of special character so it knows the wildcard is valid, but I am not sure what to put. Bascially, I want to check to see if the file is there, but the 12AM and the .gz part are not always present, so I don't want the check to fail simply because the file is not zipped.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Normally you would have something like..
if
then
foo bar
fi
but what if you wanted to do something like
if
then
foo bar
fi
How do I get Unix to accept anything that matches a pattern of FILENAME with anything after it during an in if statement? (3 Replies)
Discussion started by: LordJezo
3 Replies
2. Shell Programming and Scripting
How to put a line of strings (with some white spaces in between) from a file into variables?
I have tried the following codes. However, the content is cut by space (not by line)
for i in `cat ${source_file}`
do
echo $i
done
Please comment. Thanks. (2 Replies)
Discussion started by: Rock
2 Replies
3. Shell Programming and Scripting
Hello
i am trying to use the wildcards with the if statement but it is displaying the error like this one
if * | ** | * ]
Any body can help me to for using the wild card option in the if case but i have used this code and working well with the case statement to enter the name without the... (14 Replies)
Discussion started by: murtaza
14 Replies
4. Shell Programming and Scripting
Hi All,
I'll get a file whose 2nd line contains 3 fields: filename(variable length), file size char(10), and record count int(10). How do I cut it and put it into 3 variables?
eg: abcd.csv01234567891111111111
now I want: $one = abcd.csv, $two = 0123456789, $three = 1111111111.
I also... (8 Replies)
Discussion started by: Mandab
8 Replies
5. Shell Programming and Scripting
i want to use multple sql count statements and store these count values in unix variable but in one connection only i.e. in only 1 time database should be hit ,which is the main requirement. (1 Reply)
Discussion started by: sw@pnil
1 Replies
6. Shell Programming and Scripting
I'm a newbie here, today I've got a problem. Here's the shell:
b.sh
#!/bin/bash
rm -rf $1
a.sh
#!/bin/bash
for file in '/root/Desktop/test/*'
do
echo $file
sh ./b.sh $file
done
ls /root/Desktop/test
When I sh a.sh, the result is : (2 Replies)
Discussion started by: very.very.sorry
2 Replies
7. Shell Programming and Scripting
Hey guys, i have got a problem...zenity is not being able to read my variables in its radiolist options.
as zenity needs a FALSE in front of a radiolist options, i have decided to ...
op=$(awk '{print "FALSE" " " $2} /etc/fstab)
$?=$(zenity --list --text "mount" --radiolist --column... (1 Reply)
Discussion started by: dplate07
1 Replies
8. UNIX for Dummies Questions & Answers
Probably a stupid question... how do I use a wildcard in a variable in zsh? If I do:
var=*
echo $var
in bash, it will print all files/directories in the current directory. If I do it in zsh, it will only output an asterisk without the wildcard functionality. Thanks in advance! (1 Reply)
Discussion started by: RainbowLAr
1 Replies
9. Shell Programming and Scripting
Hi All,
Seeking for your assistance on how to put in variables all the commands in /bin
config files: /home/test/config_file/config.cfg
cat /home/test/config_file/config.cfg
ECHO=/bin/echo
LS=/bin/lsMain script
cat test.sh
source=/home/test/config_file/config.cfg
ECHO=$ECHO
LS=$LS#i... (3 Replies)
Discussion started by: znesotomayor
3 Replies
10. UNIX for Beginners Questions & Answers
Dear Forum members,
I am having trouble getting the complete filename (and directory path) in a variable.
Output directory mentioned in the code have three files:
DISPLAY_CITY_DETAILS_15-05-2019-08-29-26_MIGRATE_london.out
DISPLAY_CITY_DETAILS_15-05-2019-08-29-26_MIGRATE_paris.out... (4 Replies)
Discussion started by: chetanojha
4 Replies
LEARN ABOUT REDHAT
ypserv.conf
YPSERV.CONF(5) Reference Manual YPSERV.CONF(5)
NAME
ypserv.conf - configuration file for ypserv and rpc.ypxfrd
DESCRIPTION
ypserv.conf is an ASCII file which contains some options for ypserv. It also contains a list of rules for special host and map access for
ypserv and rpc.ypxfrd. This file will be read by ypserv and rpc.ypxfrd at startup, or when receiving a SIGHUP signal.
There is one entry per line. If the line is a option line, the format is:
option: <argument>
The line for an access rule has the format:
host:domain:map:security
All rules are tried one by one. If no match is found, access to a map is allowed.
Following options exist:
files: 30
This option specifies, how many database files should be cached by ypserv. If 0 is specified, caching is disabled. Decreasing this
number is only possible, if ypserv is restarted.
trusted_master: server
If this option is set on a slave server, new maps from the host server will be accepted as master. The default is, that no trusted
master is set and new maps will not be accepted.
Example:
trusted_master: ypmaster.example.org
xfr_check_port: [<yes>|no]
With this option enabled, the NIS master server have to run on a port < 1024. The default is "yes" (enabled).
The field descriptions for the access rule lines are:
host IP address. Wildcards are allowed.
Examples:
131.234. = 131.234.0.0/255.255.0.0
131.234.214.0/255.255.254.0
domain specifies the domain, for which this rule should be applied. An asterix as wildcard is allowed.
map name of the map, or asterisk for all maps.
security
one of none, port, deny:
none always allow access.
port allow access if from port < 1024. Otherwise do not allow access.
deny deny access to this map.
FILES
/etc/ypserv.conf
SEE ALSO
ypserv(8), rpc.ypxfrd(8)
WARNINGS
The access rules for special maps are no real improvement in security, but they make the life a little bit harder for a potential hacker.
BUGS
Solaris clients don't use privileged ports. All security options which depend on privileged ports cause big problems on Solaris clients.
AUTHOR
Thorsten Kukuk <kukuk@suse.de>
YP Server October 2002 YPSERV.CONF(5)